Infragistics components on build server
Asked Answered
E

5

19

I have "inherited" a new (old?) Winforms project and would like to put it onto our build server (Bamboo). That build server has only the absolute minimum (.NET 3.5 and not much more) installed, and we'd like to keep it that way.

As a first step, I extracted all the assembly files (*.dll) for the Infragistics components into a separate directory and referenced them from that local directory (instead of relying on them being installed in the GAC). Works OK.

But when I try to run this build on Bamboo (using MSBuild), I keep getting errors:

Properties\licenses.licx(1): error LC0004: Exception occurred creating type 'Infragistics.Win.UltraWinToolbars.UltraToolbarsManager, Infragistics2.Win.UltraWinToolbars.v7.2, Version=7.2.20072.61, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb' System.ComponentModel.LicenseException

After a bit of googling, it seems that those licenses.licx file in the projects are some kind of a licensing scheme to prevent the tools from being installed on several machines.

But how can I get rid of those so that my build server build will work, without installing the full Infragistics component set onto the build server (this is NOT an option)??

  • if I simply delete them from the projects, the build might work (haven't tried yet), but then my design time experience will suffer / not work (which of the two?)
  • having the files around so that my design time experience works prevents the automatic build from running through....

Hmmm.... classic catch-22 - any way out of this??

Edgebone answered 15/1, 2010 at 12:38 Comment(0)
E
29

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 existing licenses.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.

Edgebone answered 19/1, 2010 at 9:31 Comment(2)
I'm in the same boat. Can you explain how you copied the empty licences.licx file to all the relevant places?Ferraro
@Philip Wallace: updated my post to show in detail how I do it - hope this helps!Edgebone
S
4

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:

  1. Generate YourApp.exe.licenses file using lc.exe. Other way is to build the solution that contains licenses.licx and get it from obj\Debug or obj\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.
  2. Exclude licenses.licx from project.
  3. Add YourApp.exe.licenses to project as embedded resource.
  4. 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.

  5. 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.

Stillness answered 6/7, 2015 at 22:32 Comment(0)
M
1

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).

Mansell answered 20/10, 2017 at 14:42 Comment(0)
I
0

I could build Team City project based on answer by marc_s i.e. by replacing existing license file with blank licenses.licx.

But there was another hick up when i tried opening aspx pages having infragistics controls on local machine, it gives error as i have infragistics installed on local machine but my licenses.licx is blank.

I found a workaround for this as below:

  • Created a new configuration in Visual Studio specifically to build projects in Team City

enter image description here

<Target Name="BeforeBuild" Condition="$(Configuration)==CI_TeamCity_Build">
    <CreateItem Include="$(MSBuildProjectDirectory)\licenses.licx">
      <Output TaskParameter="Include" ItemName="EmptyLicensesLicx" />
    </CreateItem>
    <Copy SourceFiles="@(EmptyLicensesLicx)" DestinationFolder="$(MSBuildProjectDirectory)\Properties\" ContinueOnError="true" />
</Target>
  • Added 'BeforeBuild' target as mentioned by marc_s additionally i have added a condition that this task will be executed when my build is using 'CI_TeamCity_Build' and not for 'Debug' or 'Release' build

  • Team City build configuration is using above configuration in "VS Solution Build Runner" step. Due to 'BeforeBuild' target in csproj file, it replace license file with blank one and build succeeds.

  • On my local machine I continue using 'Debug' or 'Release' build as it won't replace licenses.licx file with blank one. All infragistics controls appear on .aspx page without any issue.

Inextensible answered 29/7, 2016 at 5:13 Comment(0)
R
0

I ran into this problem recently using TeamCity 9.1 as my build server.

When we originally set up the build server, we didn't want to install Infragistics on the machine, so we created a References folder where we copied the required assemblies and checked them in. (I know this is undesirable but it's a work-around.)

Ensure that the projects reference the assemblies at the new path. This creates a HintPath entry in the project file(s) for each assembly.

Finally, edit the project file manually to add <Private>True</Private> to each reference. (It wasn't enough to set the Copy Local property to true.)

Rowdyism answered 24/8, 2016 at 19:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.