定义 .net 引用以始终使用最新版本的 GAC d dll?
我们有一个供应商正在为我们编写一个应用程序,该应用程序使用我提供给他们的 dll。我的老板刚刚发现,如果我们需要对其中一个 dll 进行更改,我们就必须向供应商提供更新的版本,以便他们可以重新编译他们的项目。这会导致问题,因为我们没有自动化测试,任何新的构建都需要我们的 QA 部门进行完整的运行。
我之前没有与 GAC 做过太多工作,但相信这可能就是我们正在寻找的。有没有一种方法可以将我的 dll(我提供给供应商的那个)部署到 GAC 并让供应商构建他们的 .net 项目,以便始终从 GAC 获取最新版本?
We have a vendor who is writing an application for us who makes use of a dll I've provided to them. My boss just found out that if we ever need to make a change to one of our dll's we'd have to provide the updated version to the vendor so they could recompile their project. This causes problems because we don't have automated testing and any new build would require a complete run-through by our QA department.
I've not done too much with the GAC before but believe it could be what we're looking for. Is there a way I could deploy my dll (the one I provide to the vendor) to the GAC and have the vendor build their .net project in such a way as to always grab the latest version from the GAC?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
他们需要在正在编译的项目中将引用的
SpecificVersion
属性设置为false
。请参阅此问题和它链接到的文章。They will need to set the
SpecificVersion
property of the reference tofalse
in the project that they're compiling. See this question and the article that it links to.如果您对 DLL 进行了重大更改,您当然需要发布新版本,以便您的供应商可以使用它进行编译。
但除此之外,供应商不需要拥有最新版本。相反,您可以使用程序集绑定重定向来确保您在运行时使用最合适的(通常是最新的)版本。
有多种方法可以实现此目的,如链接文章中所述 - 最常见的是使用应用程序配置文件中的设置(如果您只想影响此应用程序)或发布者策略文件(如果您想影响所有应用程序)使用共享程序集)。
If you have made a breaking change in your DLL, you will of course need to ship the new version so your vendor can compile with it.
But otherwise there is no need for the vendor to have the latest version. Instead you can use Assembly Binding Redirection to ensure you are using the most appropriate (usually latest) version at runtime.
There are several ways to achieve this as described in the linked article - the most common is to use settings in the application configuration file (if you only want to affect this application) or a publisher policy file (if you want to affect all applications that use the shared assembly).