.net参考specificversion是真还是虚? [英] .net reference specificversion true or false?

查看:166
本文介绍了.net参考specificversion是真还是虚?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在同一个应用程序中,我们是两个在同一个项目上工作的公司。每周我们交换我们的程序集(而不是代码)并引用彼此的dll。



有关 specificversion 添加引用到我们的项目。
具体来说,我们什么时候应该使用 specificversion true 我们应该使用什么情况 false

解决方案

p>这个答案将基于你对你的dll进行版本控制的假设。



如果你将SpecificVersion设置为true(添加引用时是默认值)那么项目将引用该dll的特定版本(例如1.0.0.0)。如果在以后的时候,你会得到一个新的dll(比如1.0.1.0),那么你将不得不删除旧的dll参考并添​​加新的引用。这是因为当您有1.0.1.0版本的新版本时,该项目正在寻找1.0.0.0。



替代方案是将SpecificVersion设置为false告诉项目找到最新的可用dll并使用它。这个问题是,该项目现在需要在您参考的dll的各个地方狩猎,这可能会增加您的构建时间。即使它知道您引用的dll的路径,它也会这样做。我不知道这是否是一个错误,或者是否通过设计完成。这可能是检查,除了你引用的(或者在GAC或其他地方)之外是否有更新的DLL。



这是一个文章更详细地描述了这个问题。 p>

We are two companies who are working on the same project, in the same application. On a weekly basis we exchange only our assemblies (not the code) and reference each other's dll.

What is the best practice regarding the specificversion when adding reference to our project. Specifically, when should we use a specificversion value of true and in what case should we use false.

解决方案

This answer is going to be based on the assumption that you are versioning your dlls.

If you set SpecificVersion to true (which is the default when adding a reference), then the project will reference to that dll with a particular version (say for instance 1.0.0.0). If, at a later time, you're given a new dll (say 1.0.1.0), then you will have to remove the old dll reference and add the new reference. This is because the project is specifically looking for 1.0.0.0 when you have a new version 1.0.1.0.

The alternative to this is to set the SpecificVersion to false, which tells the project to find the latest available dll and use that one. The problem with this is that the project is now required to "hunt" in various places for the dll you've referenced, which can increase your build time. It will do this even though it knows the path of the dll you've referenced. I'm not sure if this is a bug or if this is done by design. It might be checking to see if there are any newer dlls besides the one you've referenced (perhaps in the GAC or elsewhere).

Here's an article that describes this issue in more detail.

这篇关于.net参考specificversion是真还是虚?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆