Fun With the GAC

The .Net GAC (Global Assembly Cache). It’s where all shared .Net components can live. However, if you have to step through the code of one of these assemblies things can get exciting…

Let’s say that I have a Business Object dll named business.dll and I have it in my GAC. And a project in which I’m referencing that dll is having problems, inside that component. I go to source control and check out the source. Add that project into my solution in Visual Studio. Unreference the GAC version, and reference the local project. I should be able to step through, right?

Wrong. The CLR resolves assemblies in the GAC before anywhere else.

Go into your GAC (C:\Windows\Assembly\GAC_MSIL) and rename the dll with an extension like “.bak”. Don’t forget to rename it after your done debugging 🙂


Posted

in

by

Tags:

Comments

One response to “Fun With the GAC”

  1. arsic Avatar
    arsic

    well we have developer PC and deploying PC. On deploying PC it goes to GAC without saying. On developer PC we may use regasm to reg assembly in any place you like. I prefer do it in Post-Build step in VS project.