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:

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:

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: 

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)