开发者

Infragistics components on build server

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 an开发者_StackOverflowd 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??


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.


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.


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


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

Infragistics components on build server

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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜