SqlCompare Assembly Dynamically Loaded
samelmore
Posts: 3
I am trying to create an Nant custom task assembly so that I can automate some of the functions of the Sql Compare toolkit in my Nant build scripts. I have successfully created the Nant custom task and also have the Sql Compare command line properly registered. I have created the .lic file in my project as specified in the docs.
I believe that there is a problem with the way the Sql Compare Toolkit does it's licensing when run in a dynamic module (my custom task assembly which references the Sql Compare toolkit is loaded at runtime by the Nant assemblies). My Nant scripts are throwing this error:
System.NotSupportedException: The invoked member is not supported in a dynamic module.
The stack trace shows the following:
at System.Reflection.Emit.AssemblyBuilder.get_CodeBase()
at System.Reflection.Assembly.get_EscapedCodeBase()
at ?.?(Type )
at ?.GetLicense(LicenseContext context, Type type, Object instance, Boolean allowExceptions)
at System.ComponentModel.LicenseManager.ValidateInternalRecursive(LicenseContext context, Type type, Object instance, Boolean allowExceptions, License& license, String& licenseKey)
at System.ComponentModel.LicenseManager.ValidateInternal(Type type, Object instance, Boolean allowExceptions, License& license)
at System.ComponentModel.LicenseManager.Validate(Type type, Object instance)
at RedGate.SQLCompare.Engine.Database..ctor()
Any way that this can be fixed?
Thanks,
Sam
I believe that there is a problem with the way the Sql Compare Toolkit does it's licensing when run in a dynamic module (my custom task assembly which references the Sql Compare toolkit is loaded at runtime by the Nant assemblies). My Nant scripts are throwing this error:
System.NotSupportedException: The invoked member is not supported in a dynamic module.
The stack trace shows the following:
at System.Reflection.Emit.AssemblyBuilder.get_CodeBase()
at System.Reflection.Assembly.get_EscapedCodeBase()
at ?.?(Type )
at ?.GetLicense(LicenseContext context, Type type, Object instance, Boolean allowExceptions)
at System.ComponentModel.LicenseManager.ValidateInternalRecursive(LicenseContext context, Type type, Object instance, Boolean allowExceptions, License& license, String& licenseKey)
at System.ComponentModel.LicenseManager.ValidateInternal(Type type, Object instance, Boolean allowExceptions, License& license)
at System.ComponentModel.LicenseManager.Validate(Type type, Object instance)
at RedGate.SQLCompare.Engine.Database..ctor()
Any way that this can be fixed?
Thanks,
Sam
This discussion has been closed.
Comments
The last person who had this problem had fixed it by declaring the function that used Database.Register as a static function. Hopefully that will work for you as well.
Please let me know if I can help further.
Sam
The incompatibility with NAnt has been solved in version 3.1.9 of SQL Compare Engine. Please use the SQL Bundle's Check for Updates function to get the newer version of the dll.