Lc.exe (License Compiler)
The License Compiler reads text files that contain licensing information and produces a binary file that can be embedded in a common language runtime executable as a resource.
A .licx text file is automatically generated or updated by the Windows Forms Designer whenever a licensed control is added to the form. As part of compilation, the project system will transform the .licx text file into a .licenses binary resource that provides support for .NET control licensing. The binary resource will then be embedded in the project output.
Cross compilation between 32-bit and 64-bit is not supported when you use the License Compiler when building your project. This is because the License Compiler has to load assemblies, and loading 64-bit assemblies from a 32-bit application is not allowed, and vice versa. In this case, use the License Compiler from the command line to compile the license manually, and specify the corresponding architecture.
This tool is automatically installed with Visual Studio. To run the tool, use the Developer Command Prompt (or the Visual Studio Command Prompt in Windows 7). For more information, see Command Prompts.
At the command prompt, type the following:
lc /target: targetPE /complist:filename [/outdir:path] /i:modules [/nologo] [/v]
|/complist: filename||Specifies the name of a file that contains the list of licensed components to include in the .licenses file. Each component is referenced using its full name with only one component per line.|
Command-line users can specify a separate file for each form in the project. Lc.exe accepts multiple input files and produces a single .licenses file.
|/h[elp]||Displays command syntax and options for the tool.|
|/i: module||Specifies the modules that contain the components listed in the /complist file. To specify more than one module, use multiple /i flags.|
|/nologo||Suppresses the Microsoft startup banner display.|
|/outdir: path||Specifies the directory in which to place the output .licenses file.|
|/target: targetPE||Specifies the executable for which the .licenses file is being generated.|
|/v||Specifies verbose mode; displays compilation progress information.|
|@ file||Specifies the response (.rsp) file.|
|/?||Displays command syntax and options for the tool.|
If you are using a licensed control
Samples.DLLin an application called
HostApp.exe, you can create
HostAppLic.txtthat contains the following.
Create the .licenses file called
HostApp.exe.licensesusing the following command.
lc /target:HostApp.exe /complist:hostapplic.txt /i:Samples.DLL /outdir:c:\bindir
HostApp.exeincluding the .licenses file as a resource. If you were building a C# application you would use the following command to build your application.
csc /res:HostApp.exe.licenses /out:HostApp.exe *.cs
The following command compiles
myApp.licenses from the lists of licensed components specified by
modulesList argument specifies the modules that contain the licensed components.
lc /target:myApp /complist:hostapplic.txt /complist:hostapplic2.txt /complist: hostapplic3.txt /i:modulesList
The following listing shows an example of a response file,
response.rsp. For more information on response files, see Response Files.
/target:hostapp.exe /complist:hostapplic.txt /i:WFCPrj.dll /outdir:"C:\My Folder"
The following command line uses the