How does VS 2003 pick the correct dll's to link to while compiling?

I am using VS 2003 with Nunit. I have both the 2.0 and 1.1 assemblies of nunit on my machine.

I have the following directories -

>>dir | grep -i "nunit"

06/16/2006 11:05 AM <DIR> NUnit 2.2.8    //built with 1.1 framework
06/16/2006 11:06 AM <DIR> Nunit-Net-2.0 2.2.8    //built with 2.0 framework

My GAC for Nunit looks as follows -

>>gacutil /l | grep "nunit"

nunit.framework, Version=2.2.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL   
nunit.framework, Version=2.2.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77 

Whenever I do a fresh checkout of an .NET 1.1 application, all the references to nunit.framework.dll point to the "Nunit-Net-2.0 2.2.8" folder even though the references were created by pointing to the "NUnit 2.2.8", i.e., the properties window for the nunit.framework reference shows the full path of "Nunit-Net-2.0 2.2.8" folder. Hence, projects that have refernce to the nunit.framework fail to compile.

I know that VS 2003 uses <HintPath> element in the .csproj file, and <ReferencePath> element in the .csproj.user file to resolve the references. The HintPath property retains the correct value, and would resolve to the correct assembly if VS read it. But, it's ignoring it in preference to wherever else it's getting it's value from!

So, I made sure both (HintPath and ReferencePath) elements are empty. Regardless, the same happens

Does anybody know why this happening, and how does VS get this Path property when it is not specified anywhere in my project or settings

I can only speculate about the fact that it comes from the GAC, which points to the physical path of one of the nunit.framework.dll files. My questions are:

  1. Is my understanding correct I thought that the GAC houses the assemblies, but does it also store the information about location from the where a certain assembly was added (I checked the Codebase property of these assemblies in the GAC, and there is no physical path they point to) If not, how does VS even know about "Nunit-Net-2.0 2.2.8" folder
  2. Is there a way for me to retain my references correctly
  3. What is order in which VS 2003 looks for assemblies to link against. i.e., does it first read the HintPath or ReferencePath. When does it look in the GAC etc.

I really appreciate any help.


Answer this question

How does VS 2003 pick the correct dll's to link to while compiling?

  • Bilberry71

    I have this same exact problem. I recently migrated VSS to TFS and as part of this, source code is now downloaded to a different set of folders. When developers get the new solution files from TFS all of the Web site/Web service assemblies reference the OLD locations! e.g. if my VSS folder is C:\Projects and my TFS folder is C:\TFSProjects, somehow Visual Studio is finding the C:\Projects references to all my shared assemblies. Nowhere in any SLN, SUO, CSPROJ, etc. file is C:\Projects referenced. All paths are relative, e.g. ..\Shared\Binaries\ABCPDF5.dll.

    My guess is this has something to do with Visual Studio caching project settings for the Web projects because there is no .user file for them perhaps


  • Art Vandolay Jr.

    Nate,

    Atleast in my case, when I modified the Reference in .csproj file to contain the following it worked ( I added the ones in bold, after posting the question here)

    <Reference
    Name = "nunit.framework"
    AssemblyName = "nunit.framework, Version=2.2.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77"
    HintPath = "..\..\Lib\nunit.framework.dll"
    />


    This is the only article I found that discusses something related to this issue.

    Also, you should try deleting everything in the VS WebCache, located at %homepath%\VSWebCache.

    Hope that helps.

  • How does VS 2003 pick the correct dll's to link to while compiling?