Selected Version Property - .Net References

When you work on a team that is working on a single project this setting comes in really handy so builds do not break.  The best use for it is when there are some 3rd party tools where all the team members might have had a chance to upgrade to the latest version. 

A good example of this just happened on a project I am working on.  Recently I upgraded to Resharper 4.5 and Gallic/MbUnit 3.0.6 and all my Unit test project compiled and ran.  But today when I got the latest source for another project, it would not compile the Unit Test projects (it did not recognize the TestFixture / Test attributes, etc).

So instead of deleting the Gallio/MBUnit references and recreating them, which could break the builds of other developers who had not updated to the latest version of Gallio/MBUnit, the solution was to set the “Specific Version” flag to false. After doing that the references showed as valid, the project compile and all the MBUnit test ran.

Before today I did not know about this setting or what it did, but I can see definite uses for it (especially in a team environment). There is one caveat to using this setting, it is only a build-time directive (for Visual Studio). It has no effect on the runtime version resolution of the referenced assembly.  So although the project build you could still get runtime issues.  This is not a major deal and can be handled by creating assembly bindings for the assembly in question so that all reference to an earlier version automatically point to the latest version (but that is the topic of another blog post).

Here is a very good link on not only this issue, but also many other things to keep in mind when working with assemblies and multiple versions of assemblies.

http://www.code-magazine.com/article.aspx?quickid=0507041&page=3

 

[AddThis]

No Comments