Infragistics components on build server

前端 未结 5 1718
陌清茗
陌清茗 2021-02-01 20:21

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 muc

相关标签:
5条回答
  • 2021-02-01 20:57

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

    0 讨论(0)
  • 2021-02-01 20:57

    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

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

    0 讨论(0)
  • 2021-02-01 20:58

    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.

    0 讨论(0)
  • 2021-02-01 21:11

    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.

    0 讨论(0)
  • 2021-02-01 21:12

    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 讨论(0)
提交回复
热议问题