In This Topic
You can create a build license to use on a build machine.
Licenses are built using the license compiler tool (lc.exe) to produce a special resource file with the .licenses file extension. Visual Studio VB.NET and C# projects automatically handle compiling the licenses.licx in the project to produce the .licenses resource file, which is linked into the target executable. The components’ run-time license keys in that licenses resource file are loaded and verified when the first instance of each component with the LicenseProvider attribute is created in the application. You can remove the licenses.licx from your Visual Studio project and add the .licenses resource in its place using the following steps:
- Build the project using the licensed components on a developer machine which is licensed for development with all the components referenced in the project (this creates the .licenses resource).
- Find the licenses.licx in the Solution Explorer window. You can use the Show All Files toolbar button to see it or expand the Properties folder.
- Right-click the licenses.licx in the Solution Explorer window, and then select Exclude From Project.
- Use Windows Explorer (outside Visual Studio) to find the .licenses file in the obj\{configuration} folder (obj\Debug or obj\Release). The file should have the name {target}.{ext}.licenses (for example: project1.exe.licenses).
- Copy that file to the project folder and rename it to remove the target name (rename it from {target}.{ext}.licenses to {ext}.licenses). For example: project1.exe.licenses to exe.licenses.
- In the Visual Studio Solution Explorer window, find the {ext}.licenses (you might need to refresh the window), then right-click the file and select Include In Project.
- Change the Build Action for the {ext}.licenses from Content to Embedded Resource.
- The project can now be built without requiring a developer license on the machine, since the license has already been built and linked into the project.
Note the following restrictions:
- The licenses resource contains the name of the target module encoded in its contents, so that licenses resource is specific to that particular project.
- The steps described above will not bypass any part of the design-time license enforcement. The developer license is still required to open forms containing instances of the licensed controls.
- If the licensed components in the project change, then special care should be taken. The licenses.licx should be added back to the project first, so that it does not get recreated (empty) by Visual Studio and cause type references (and embedded licenses in the resource) to be lost. After the new licensed components are added or changed in the licx, the above steps should be repeated.
- The above steps only apply for .NET managed code applications which use the standard .NET Framework component licensing model (ActiveX control licensing in managed .NET applications does not use this mechanism).