Infragistics components on build server
The only way I found to solve this problem is this:
- create an absolutely empty (0 byte length) file
licenses.licx
in my folder where the solution resides - during initial stages of the build, the source is extracted from my source repository
- when the time comes, just before the build begins, I copy this empty
licenses.licx
over all the existinglicenses.licx
in the various projects'Properties
directory
With this, now I have both my interactive experience working (since the proper licenses.licx
files are present), but my automatic build also doesn't break (since that empty licenses.licx
file I copied over all the real ones doesn't cause any aborts in the build)
Seems a bit hackish - but it works. Hope that helps someone, somewhere, some day.
Update: I added this BeforeBuild
step to my MSBuild build file to copy the empty *.licx
file to the locations I need:
<Target Name="BeforeBuild">
<CreateItem Include="licenses.licx">
<Output TaskParameter="Include" ItemName="EmptyLicensesLicx" />
</CreateItem>
<Copy SourceFiles="@(EmptyLicensesLicx)"
DestinationFolder="(your-target-folder-here)"
ContinueOnError="true" />
</Target>
Since I need to replace this *.licx file in several places, I actually have several of those <Copy>
tasks to achieve my goal.
We have components from other company but the approach should work if .Net licensing model is used in third-party library.
If you have licenses.licx
file then library probably uses .Net licensing model. During build process it uses lc.exe utility to build binary licenses file and then it is included in assembly as embedded resource.
What you need to do:
- Generate
YourApp.exe.licenses
file using lc.exe. Other way is to build the solution that containslicenses.licx
and get it fromobj\Debug
orobj\Release
directory. This step should be done on machine where the components are installed and registered. Also it may require to enter license code as in our case. - Exclude licenses.licx from project.
- Add
YourApp.exe.licenses
to project as embedded resource. Open .csproj of your application and edit the entry for
YourApp.exe.licenses
file. You will have something like this<EmbeddedResource Include="YourApp.exe.licenses" />
It should be changed to<EmbeddedResource Include="YourApp.exe.licenses" > <LogicalName>YourApp.exe.licenses</LogicalName> </EmbeddedResource>
This is needed to exclude namespace from resource's name.
- Build - Check - Commit.
I'm not sure how the lc.exe works but you will probably need to rebuild YourApp.exe.licenses
file from time to time.
To complement the answers above (i.e. resolving the issue by creating an empty licenses.licx file), you can install the EmptyLicensesLicx nuget package, and it will generate an empty Licenses.licx
in your project, before it gets compiled every time (which is all you need for it to work).