构建服务器上的基础设施组件
我“继承”了一个新的(旧的?)Winforms 项目,并希望将其放到我们的构建服务器(Bamboo)上。该构建服务器只安装了绝对最低限度的版本(.NET 3.5,仅此而已),我们希望保持这种状态。
第一步,我将 Infragistics 组件的所有程序集文件 (*.dll) 提取到一个单独的目录中,并从该本地目录引用它们(而不是依赖于将它们安装在 GAC 中)。工作正常。
但是当我尝试在 Bamboo 上运行此构建(使用 MSBuild)时,我不断收到错误:
属性\licenses.licx(1):错误 LC0004:创建时发生异常 类型 'Infragistics.Win.UltraWinToolbars.UltraToolbarsManager, Infragistics2.Win.UltraWinToolbars.v7.2, 版本=7.2.20072.61,文化=中立, PublicKeyToken=7dd5c3163f2cd0cb' System.ComponentModel.LicenseException
经过一番谷歌搜索后,项目中的那些 licenses.licx
文件似乎是某种许可方案,旨在防止这些工具安装在多台计算机上。
但是,我如何摆脱这些,以便我的构建服务器构建能够正常工作,而无需将完整的 Infragistics 组件集安装到构建服务器上(这不是一个选项)? ?
- 如果我只是从项目中删除它们,构建可能会起作用(还没有尝试过),但是我的设计时体验将受到影响/不起作用(两者中的哪一个?)
- 拥有这些文件,以便我的设计时体验起作用阻止自动构建运行......
嗯......经典的 catch-22 - 有什么办法摆脱这个吗?
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??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我发现解决这个问题的唯一方法是:
licenses.licx
,在构建的初始阶段解决方案驻留在该文件夹中licenses.licx
覆盖各个项目的中的所有现有
目录licenses.licx
>Properties有了这个,现在我的交互体验都可以工作(因为存在正确的
licenses.licx
文件),但我的自动构建也不会中断(因为空的我在所有真实文件上复制的licenses.licx
文件不会导致构建中出现任何中止)看起来有点黑客 - 但它有效。希望有一天能帮助某人、某地。
更新:我将此
BeforeBuild
步骤添加到我的 MSBuild 构建文件中,以将空的*.licx
文件复制到我需要的位置:因为我需要为了在几个地方替换这个 *.licx 文件,我实际上有几个
任务来实现我的目标。The only way I found to solve this problem is this:
licenses.licx
in my folder where the solution resideslicenses.licx
over all the existinglicenses.licx
in the various projects'Properties
directoryWith 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 emptylicenses.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:Since I need to replace this *.licx file in several places, I actually have several of those
<Copy>
tasks to achieve my goal.我们有来自其他公司的组件,但如果 .Net 许可模式,该方法应该有效 用于第三方库。
如果您有
licenses.licx
文件,则库可能使用 .Net 许可模式。在构建过程中,它使用 lc.exe 用于构建二进制许可证文件的实用程序,然后将其作为嵌入式资源包含在程序集中。您需要做什么:
YourApp.exe.licenses
文件。另一种方法是构建包含licenses.licx
的解决方案并从obj\Debug
或obj\Release
目录获取它。此步骤应在安装和注册组件的计算机上完成。此外,它可能需要输入许可证代码,就像我们的例子一样。YourApp.exe.licenses
添加到项目中作为嵌入式资源。打开应用程序的 .csproj 并编辑
YourApp.exe.licenses
文件的条目。您将得到类似
的内容,应将其更改为这是从资源名称中排除命名空间所必需的。
我不确定 lc.exe 是如何工作的,但您可能需要不时重建
YourApp.exe.licenses
文件。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:
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.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 toThis is needed to exclude namespace from resource's name.
I'm not sure how the lc.exe works but you will probably need to rebuild
YourApp.exe.licenses
file from time to time.为了补充上述答案(即通过创建空的 licenses.licx 文件来解决问题),您可以安装 EmptyLicensesLicx< /a> nuget 包,它会在每次编译之前在您的项目中生成一个空的
Licenses.licx
(这就是它工作所需的全部内容)。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).我可以根据 marc_s 的答案构建 Team City 项目,即通过用空白许可证.licx 替换现有许可证文件。
但是,当我尝试在本地计算机上打开具有 infragistics 控件的 aspx 页面时,出现了另一个问题,它给出了错误,因为我在本地计算机上安装了 infragistics 但我的 licenses.licx 是空白的。
我找到了解决方法如下:
< img src="https://i.sstatic.net/zvofL.png" alt="在此处输入图像描述">
添加了 marc_s 提到的“BeforeBuild”目标,另外我还添加了一个条件当我的构建使用“CI_TeamCity_Build”而不是“调试”或“发布”构建时,将执行此任务
Team City 构建配置使用“VS Solution Build Runner”步骤中的上述配置。由于 csproj 文件中存在“BeforeBuild”目标,它将许可证文件替换为空白文件并且构建成功。
在我的本地计算机上,我继续使用“调试”或“发布”构建,因为它不会用空白文件替换 licenses.licx 文件。所有 infragistics 控件都显示在 .aspx 页面上,没有任何问题。
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:
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.
我最近使用 TeamCity 9.1 作为构建服务器遇到了这个问题。
当我们最初设置构建服务器时,我们不想在计算机上安装 Infragistics,因此我们创建了一个 References 文件夹,在其中复制所需的程序集并将它们签入。(我知道这是不可取的,但这是一种解决方法.)
确保项目引用新路径中的程序集。这会在项目文件中为每个程序集创建一个 HintPath 条目。
最后手动编辑项目文件添加
<私人>真实到每个参考。 (将“复制本地”属性设置为 true 还不够。)
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.)