Visual Studio 2008 resolves invalid link

In my project file, I have the following entry:

<Reference Include="Microsoft.Practices.Unity, Version=1.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <HintPath>..\..\..\..\Libraries\Microsoft.Practices.Unity.dll</HintPath> </Reference> 

which in absolute terms translates into:

C: \ dev \ LUT600 2.1.1 \ OCC600 \ Libraries

Somehow, when I try to compile a project, Visual Studio loads the link from a completely different path:

/ reference: "C: \ Program Files \ Microsoft Enterprise Library 4.1 - October 2008 \ Bin \ Microsoft.Practices.Unity.dll.

How it resolves this location is a complete mystery, as this DLL is not mentioned anywhere in this project.

I set Specific Verion to true, but it still resolves the link from this location.

Any ideas?

TIA.

Klaus

+4
source share
3 answers

The link may not have the same version number as the assembly in that particular location, so it starts searching elsewhere to find the β€œbest” match.

Instead of just specifying the specified file, VS always uses a trial path to try and find referenced assemblies. This often gives a random β€œpick something with the same name” effect. On our build server, I once found 996 build instances. 995 were the same, the correct version, and one was the wrong version. And once our assembly stopped working when, for no apparent reason, suddenly decided to use one wrong copy!

Try deleting and re-creating the link. This often helps.

In the worst case, delete all copies of this assembly from your PC, except for the version to which you want to install the link. (if possible, without destroying anything that you value)

+3
source

Most likely, you added the link from GAC (Global Assembly Cache). A long list of links that take time to download are links from the GAC. Try deleting your link and re-adding it by viewing this assembly in the Add Links dialog box.

0
source

It can be a dll search in the search path before it evaluates HintPath. As mentioned in this post , there are two places that were found before HintPath.

  • Files from the current project, indicated by {CandidateAssemblyFiles}.
  • $ (ReferencePath), which comes from the .user / target file.
0
source

All Articles