How to prevent a project from referencing an assembly in the GAC

M

mje11

Hi there

I have a class library project (AssemblyA) and a 'test' project grouped
under the same solution. AssemblyA is strongly-named and I have a
version of the assembly in the GAC.

In the test project I have added a project reference to AssemblyA. If I
make changes to AssemblyA (e.g. add a new class) and then try to run
the project in debug mode, Visual Studio loads the AssemblyA from the
GAC and hence cannot find the new type. How do I force Visual Studio to
use the 'local' copy of the assembly, not the one in the GAC?

Any help would be much appreciated.
Matt
 
G

Guest

Look at the reference and where it is set to. You should be able to point at
the newly compiled assembly and solve the problem.

For the record, you should only use the GAC for global assemblies and
preferably only when they are stable and mature. If you are constantly
changing an assembly, it is not ready for the GAC.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
M

mje11

Thanks for your response, Gregory.

If I right-click on the reference to AssemblyA in the test project, the
path points to \obj\debug\AssemblyA.dll. However, the version in the
GAC is still loaded.

We use a terminal server here, for developing and for live
applications, so the GAC contains stable releases. I need to be able to
make changes to the AssemblyA code and test them from the test project
within the IDE, but I can't do this at the moment.
 
C

Chris Dunaway

when you set a project reference and then click on the reference, what
is the setting of the copylocal property? It may be that the new
assembly is not in the bin folder of the app so .Net looks in the GAC
and finds it there.
 
M

mje11

The CopyLocal setting was set to true, but it makes no difference if I
set it to false - it always loads from the GAC.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top