在编译时将引用路径从 GAC 更改为文件夹

发布于 2024-12-05 12:04:50 字数 222 浏览 6 评论 0原文

我有一个依赖于一些第三方库的项目。这些程序集已在 GAC 中注册。到目前为止一切正常。 但是,当在构建服务器上构建项目时,第 3 方程序集不在 GAC 中,而是在一个额外的文件夹(称为 external)中,该文件夹也在构建服务器使用的 SVN 存储库中。

由于 MSBuild 找不到这些程序集,构建将失败。有没有办法告诉构建服务器上的 MSBuild 使用此文件夹中的程序集而不是 GAC?

I have a project that depends on some 3rd party libraries. These assemblies are registered int the GAC. Everythings works fine so far.
But when building the project on the build server, the 3rd party assemblies are not in the GAC, but in an extra folder (called external) that is also in the SVN-repository the build server uses.

The build will fail due to the fact that MSBuild can't find these assemblies. Is there a way to tell MSBuild on the buildserver to use the assemblys from this folder instead of the GAC?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

与酒说心事 2024-12-12 12:04:50

最佳实践是在构建时引用来自 GAC 的第 3 方程序集。相反,从公共源代码管理文件夹引用所有第 3 方程序集。

如果您使用编辑器打开项目,理想情况下您将为每个第 3 方参考提供一个 HintPath。 IE:

<Reference Include="Microsoft.Practices.Unity">
  <HintPath>..\..\..\3rd Party\Prism4\Microsoft.Practices.Unity.dll</HintPath>
</Reference>

The best practice is NOT to reference 3rd-party assemblies from the GAC on build time. Instead, have all 3rd-party assemblies referenced from a common source controlled folder.

If you open the projects with an editor, ideally you will have a HintPath for each 3rd-party reference. I.e:

<Reference Include="Microsoft.Practices.Unity">
  <HintPath>..\..\..\3rd Party\Prism4\Microsoft.Practices.Unity.dll</HintPath>
</Reference>
素染倾城色 2024-12-12 12:04:50

这应该可以工作

MSBuild.exe "%BUILD_TARGET%" /t:rebuild /p:OutputPath="%OUTPUT_PATH%" /p:ReferencePath="%REF_PATH%"

相关位将是c的“ReferencePath”参数:)

This should work

MSBuild.exe "%BUILD_TARGET%" /t:rebuild /p:OutputPath="%OUTPUT_PATH%" /p:ReferencePath="%REF_PATH%"

The relevant bit would be the 'ReferencePath' parameter ofc :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文