≡ Menu

Pain with .NET 4 assemblies and the GAC

Installing a Microsoft .NET assembly into the GAC used to be fairly trivial. Unfortunately, I just spent some frustrating time learning that things have changed quite a bit with .NET 4.

I began with my .NET 4 assembly and tried to install it via the usual approach, dragging and dropping it into the %windir%\assembly folder via the Explorer shell extension. Strange; nothing happened.

A quick search revealed that for .NET 4, Microsoft, for reasons which do not seem to be well documented, have created a new GAC location, in the %windir%\Microsoft.NET folder.

Well, that was annoying, I thought: but I could deal with it. I tried dropping the file into the new GAC folder… but there is no nice Explorer shell extension for the new GAC. Doh! (for the second time)

Ok, time to drop to the command line and fire up good ol’ gacutil.exe.


I received this error message:
“Failure adding assembly to the cache: This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.”

Sigh. Ok, I thought, I’ll just use the .NET 4 version of gacutil.exe. After a quick search of my PC I learned that it’s not installed with Version 4 of framework, nor with Visual Studio 10.

Yet another brick wall! But no worries – I would just download it. I found out via Matt Whetton’s Blog that I needed to download Microsoft Windows SDK for Windows 7 and .NET Framework 4 to get it, so I did (while wondering why I need to download that whole SDK to get gacutil??)

So then I found gacutil in the bin folder of the SDK and I ran it. Arrgh, it returned the same error message again!

Eventually I found the .NET 4 version of GACUtil in the SDK – it’s nestled in
C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\NETFX 4.0 Tools.

Sigh. Could Microsoft really make things any more difficult? I just wanted to install an assembly into the GAC!

By the way, if you need to copy gacutil onto a server, you will need to copy the following files to it: gacutil.exe, gacutil.exe.config and gacutlrc.dll (the last one located in the 1033 sub folder containing gacutil).

{ 7 comments… add one }
  • Simon October 5, 2011, 5:08 pm

    Why use the GAC? That way lies fear, misery and death!
    Just give apps all their dependencies they need.

    • brendan October 6, 2011, 3:28 am

      Agreed, in general – and it certainly seems like Microsoft are trying to turn us away from using the GAC, too!

      This was an exceptional case, where I needed to have the WCFSvcHost process assembly in the GAC.

  • Damien October 8, 2011, 6:02 am

    Thanks for the tips… will come in handy…

  • Kane November 1, 2011, 12:53 pm

    It took me years to find out what the good old 1033 folder means… but as it turns it it is the language code for English.

    Thanks to a good friend of mine Francisco Rodriguez for enlighting me.

    PS, using the GAC sucks

  • yang May 7, 2013, 9:33 am

    install assembly

    gacutil -i AssemblyName


    gacutil /u AssemblyName (Fully Qualified Name of Assembly)

    more about add remove…



  • Whateverman January 3, 2014, 5:16 pm

    This saved me at least an hour or two of researching and grumbling. Thanks!

Leave a Comment