Tuesday, September 4, 2012

Installing dlls to GAC with .net Framework 4.0



I recently faced to an issue with installing dlls to GAC with .net Framework 4.0.

It was my local development machine and .net Framework 4.0. I wanted to install a dll to GAC. But gacutil.exe was not there.

.net 4.0 GAC location C:\Windows\Microsoft.NET\assembly\GAC_MSIL


I copied gacutil.exe from my  staging server to my machine. The exe was located in “C:\Windows\Microsoft.NET\Framework\v1.1.4322”.  Then I tried to install the dll. but it returned an error saying version mismatch.

When I search for the issue, I found that gacutil.exe come with the “Microsoft Windows SDK for Windows 7 and .NET Framework 4”. I downloaded SDK from here and installed in my development server. Then copied these files from development server (C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools ) to production server. Then Tried to run gacutil –i.
    gacutil.exe
    gacutil.exe.config
    1033\gacutlrc.dll

These files can be placed any location in the machine, but need to run the gacutil - command from that location.

Remember to put gacutlrc.dll in to the same folder, otherwise your command will run wiout giving any errors, but dll won’t be in GAC.