Question

I am using some 3rd party libraries in my solution and have saved these in a separate source-controlled folder called 3rdParty. I have added references to the DLLs in this folder from the VS2008 IDE. However, I find that after saving, closing and opening the solution, the references have been changed to point to the assemblies in the GAC.

The reason for using the 3rdParty folder is that I can easily get latest version from any machine and build my project without having to install anything in the GAC folder. How can I get VS2008 to leave my references untouched?

Edit: After seeing Benjol's answer, I have been wondering if I could use an assembly manifest to fix this. Will this help solve my problem?

Was it helpful?

Solution

Even if you could get VS to look in your local folder, that would be no help at runtime (I mean F5/debug runtime), because .Net will look in the GAC first anyway.

And with reference to CopyLocal, AFAIK, that just tells the compiler to copy a version of your referenced DLL into the /bin folder of your project, so there shouldn't be any issues with 'complicated' paths.

OTHER TIPS

There's a "CopyLocal" setting for references, if you set this to true and set the SpecificVersion setting to false then it should use the local references rather than the GAC ones.

GAC dlls are referenced before local ones because they are designed to be shared, but should only be selected if there is a specific version specified.

Would it be possible for you to remove these assemblies from the GAC if they continue to cause problems?

In order for it to pick up your local assembly you have to go into the project properties, under the Reference Paths tab and add the local directory (3rd party in your case) to the list of directories. This should address your problem.

We use a similar approach here where I work, although we call the folder ReferencedDLLs, and we didn't have any problems with it so far.

One thing you can try, though, is to edit the project file to remove the PathHint for the references in question, this way the VS2008 doesn't know where to look and it will start the normal approach.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top