Manually licensing Redgate assemblies
Published 06 March 2013
SQL Comparison SDK allows you to use the comparison and deployment capabilities of SQL Compare and SQL Data Compare in your own .NET projects. In order to use a SQL Comparison SDK-based application, however, licensing must be performed at build-time. This is done automatically by Microsoft Visual Studio when a licenses.licx file is detected, but it is also possible to licence your application manually from the command prompt. This is useful if you do not develop using the Visual Studio IDE or are experiencing difficulty in getting the licensing to work as it should.
Licenses for SQL Comparison SDK are created using lc.exe, which is part of Microsoft's .NET Framework Software Development Kit (SDK). lc.exe creates a file which needs to be built into your .NET assembly as an embedded resource. These are the steps for performing licensing of a schema comparison project called MyApp.exe from a command prompt, outside of Visual Studio:
- Launch a Visual Studio command prompt from the Tools menu of the Visual Studio program group.
- Change directory to your project folder where your project's source code is located.
- Create a new license.txt document for the licence information.
Enter the following into licence.txt:
RedGate.SQLCompare.Engine.Database, RedGate.SQLCompare.Engine
If you were also referencing Data Compare's engine, you would mention it on the next line:
RedGate.SQLDataCompare.Engine.ComparisonSession, RedGate.SQLDataCompare.Engine
- Save the file and exit.
Run the licence compiler:
lc.exe /target:"MyApp.exe" /complist:"licence.txt" /i:"c:\program files\red gate\sql compare 7\RedGate.SQLCompare.Engine.dll"
If your project also references the Data Compare libraries, they should be included in the references here as well by adding this to the command above:
/i:"c:\program files\red gate\sql data compare 7\RedGate.SQLDataCompare.Engine.dll"
This produces a file called MyApp.exe.licenses.
Compile the application, including your .licenses file as an embedded resource:
csc /res:"MyApp.exe.licenses" /out:"MyApp.exe" /r:"c:\program files\red gate\sql compare 7\RedGate.SQLCompare.Engine.dll" /r:"c:\program files\red gate\sql compare 7\RedGate.Shared.SQL.dll" /r:"c:\program files\red gate\sql compare 7\RedGate.Shared.Utils.dll" *.cs