Adding references adds wrong version
When adding a reference to VS 2008, the version is listed as v1.0.0.0 when it should be v1.1.0.0 - as far as I can see there is absolutely no reason why it is adding the wrong version.
Both projects are written from scratch, no other refs reference the assembly I'm trying to add and when I look at the file in windows, it has the correct version, yet somehow VS still picks up the wrong one (the target path is correct).
Does anyone know how to get VS to choose the version that I'm pointing it to, and not some older version it decides (for no reason at all) is the correct one?
I asked this question before, but there were no answers that solved the problem...
I AM DEFINITELY PICKING THE CORRECT FILE开发者_如何学JAVA.
I was having the same issue and discovered that I had a reference path set (from the Reference Paths button on the References tab of the Project properties). This meant that as I added the assemblies, it was trying to find them in the reference path first, rather than the directory I selected them from.
I removed the reference path and was able to add the files correctly.
I solved this issue by going into the project I'm trying to reference, REMOVING ALL references (e.g. system, system.core, system.data etc) and adding them all back in. This solved the problem.
I can't explain why this is the solution, especially as this project didn't have any other references in other than what you get by default.
In my case the problem was caused by some ItemGroup
tags within the project file which I used to add the external assemblies to the project (to make sure version control considers them). Depending on the order of the item groups, the correct version of the external assembly has been added as reference or not.
E.g. Trying to reference the external assembly Foo.dll at the version 1.1.0.0, VisualStudio referenced the version 1.0.0.0, because Foo.dll has been present in the item group <None Include="External Assemblies\Bar\Foo.dll" />
being higher in the item group list than <None Include="External Assemblies\Foo\Foo.dll" />
.
By reordering the item groups I was able to reference the desired version.
精彩评论