SQL Comparison SDK 10

Troubleshooting the SQL Comparison SDK

Often there are problems licensing SQL Comparison SDK applications, especially when upgrading versions. The following information outlines the common causes and solutions for problems that occur when applying a Red Gate serial number to a programming project that integrates the Red Gate SQL Comparison APIs.

Before you begin, make sure you have a valid activated SQL Comparison SDK serial number. If you don't, the applications you distribute will display a trial expiry dialog box and eventually stop working at the deployment site.

It's possible for an SDK application to continue functioning on the computer used for application development if the licence has been activated previously, so it's important to test the licensing has been applied correctly before deploying the application to your users.

Setting up licensing for an application that integrates the SDK's data comparison APIs

Install SQL Data Compare (or Red Gate SQL Bundle containing SQL Data Compare) and note down the installation folder. By default, the location is C:\Program Files\Red Gate\SQL Data Compare <version>\, where <version> is the major version number of the product.

When adding a reference to the Red Gate components in your Visual Studio project, the assemblies you choose are found in this location. Visual Studio should also automatically add this location to your references path, so the necessary Red Gate licensing components will function properly at build time as well. In Windows Vista, make sure you open Visual Studio with an admin account. 

  1. Make sure you have a valid serial number (if you do not have a valid, activated serial number, the applications you distribute will display a trial expiry dialog box and will stop working when your trial expires.
  2. Add a licenses.licx file to your C# or Visual Basic .NET project in Visual Studio. If a licenses.licx file does not exist in your Visual Studio .NET project, you must create one by right-clicking the project, selecting Add > New Item > Text File and name the file licenses.licx. Add the following two lines (this is case sensitive):

    RedGate.SQLCompare.Engine.Database,RedGate.SQLCompare.Engine
    RedGate.SQLDataCompare.Engine.ComparisonSession,RedGate.SQLDataCompare.Engine
  3. Compile your application (click Build in Visual Studio or compile using the .NET compiler of your choice).
  4. If you have a valid licenses.licx file, you will be prompted for your serial number if this is the first time you've built a SQL Toolbelt application.
  5. In version 5 of the APIs, each time a new project is created, you are prompted for the serial number. In version 6 and up, the licence is available for all future SDK projects once activated.
  6. When your application is built correctly, the end-user can run it without having to licence it again. Otherwise, the end-user will be presented with a dialog informing them that the SQL Comparison SDK is not licensed. 
  7. Distribute your application to your end-user. You must distribute the following files with your application:
  • RedGate.SQL.Shared.dll
  • RedGate.SQLCompare.Engine.dll
  • RedGate.SQLCompare.Rewriter.dll
  • RedGate.SQLCompare.ASTParser.dll
  • RedGate.SQLDataCompare.Engine.dll
    If the compare to backup functionality from SQL Data Compare API is used, also include:
  • RedGate.BackupReader.dll
  • RedGate.SQLCompare.BackupReader.dll

You don't need to distribute RedGate.Licensing.Client.dll as it is only used by Visual Studio during compile time. The licence is embedded in the assembly by the compiler. 

Setting up licensing for an application that integrates the SDK's schema comparison APIs

For SQL Compare API, the approach is similar. Again, all references should be pointing to the same directory:

 C:\Program Files\Red Gate\SQL Compare <version>\

  1. If you do not have a valid, activated serial number, the applications you distribute will display a trial expiry dialog box and will stop working after 14 days.
  2. Add a licenses.licx file to your C# or Visual Basic .NET project in Visual Studio.  If a licenses.licx file does not exist in your Visual Studio .NET project, you must create one by right-clicking the project, selecting Add > New Item > Text File and name the file licenses.licx. Add the following line (this is case sensitive):

    RedGate.SQLCompare.Engine.Database,RedGate.SQLCompare.Engine 
  3. If you have a valid serial number and a valid licenses.licx file, your executable file will run without displaying the trial expiry dialog box.
  4. Distribute your application. You must distribute the following files:
  • RedGate.SQL.Shared.dll
  • RedGate.SQLCompare.Engine.dll
  • RedGate.SQLCompare.Rewriter.dll
  • RedGate.SQLCompare.ASTParser.dll

You do not need to distribute RedGate.Licensing.Client.dll as it is only used by Visual Studio during compile time. The licence is embedded in the assembly by the compiler.

Licenses.licx

A few guidelines for the licenses.licx file: 

  • Don't copy the licenses.licx file from another folder manually, for instance using a command prompt or Windows Explorer. It should be added as a new item at the Visual Studio project level with a build action of "Embedded Resource". Visual Studio 2003 sometimes ignores changes to embedded resources, so at times it may be advisable to simply recreate the file if changes that you make are not being enforced. If possible, use Explorer and delete licenses.licx, then go back into the project, right-click, add new, file, call it licenses.licx. 
  • Check the properties of licenses.licx and make sure the build action says 'Embedded Resource'.
  • The entries in licenses.licx are case-sensitive, so for SQL Data Compare, so check the entries carefully 
  • If you go to build the project, and get an error 'unable to resolve type...' , licenses.licx has been picked up by Visual Studio, but the format is wrong. 
  • If a licence file produced as the result of a successful activation is present on the build computer, the build will silently succeed. To verify that your assembly has been licensed successfully, you may use a tool such as .NET Reflector to open your assembly, expand 'resources', locate a resource called <YourAssemblyFileName>.licenses, view the resource, and make sure that the resource contains RedGate.SQLCompare.Engine.Database and also RedGate.SQLDataCompare.Engine.ComparisonSession if you had also referenced the Data Compare Engine in your project.
  • SQL Comparison SDK 6 and later will retain the product license in a global location, so it is only necessary to activate the product once. Subsequent builds will succeed silently without having to re-enter the product serial number. Versions lower than 6 would retain the activated licence in an application-specific location, so the SDK would need to be re-activated every time a new SDK project was created. This is useful because it makes a shortcut possible where the SQL Toolbelt serial number does not need to be specified for every new project. Once an SDK project is activated on the build machine, a licence file (.lic) is saved to your hard disk. Moving this file into the references path for any new project on the same machine should suppress the serial number requester and directly enter the licensing details from the licence file instead.
  • You do not need to distribute RedGate.Licensing.Client.dll as it is only used by Visual Studio during compile time. The licence is embedded in the assembly by the compiler and there is no further need for this file if the SDK had been licensed successfully. If the application being deployed shows an error message relating to a binding failure to this assembly, this indicates that the licensing for your assembly had not been successful and it needs to be rebuilt and properly licensed.

Removing the serial number that has already been activated

If the registry key below is removed then you can reactivate the product with a different serial number:

HKEY_LOCAL_MACHINE\SOFTWARE\Red Gate\Licensing\<product>\<version>\SerialNumber

 (<product> will either be SQL Comparison SDK or SQL Toolbelt)


Didn't find what you were looking for?