Thursday, 27 January 2011

Adding a DLL to the GAC in .NET 4.0

GACUTIL.EXE is no longer supplied / installed along with Visual Studio, instead it has been moved into the Windows SDK v7.1.   So to install a DLL into the GAC for .NET 4.0 (or anything after v1.1 I believe) you must first download and install the SDK.  Once you have done this you must locate the relevant version of GACUTIL from the four possible locations:

  • Program Files\Microsoft SDKs\Windows\v7.1\Bin\
  • Program Files\Microsoft SDKs\Windows\v7.1\Bin\x64
  • Program Files\Microsoft SDKs\Windows\v7.1\Bin\NETFX 4.0 Tools
  • Program Files\Microsoft SDKs\Windows\v7.1\Bin\NETFX 4.0 Tools\x64

The first two are for registering DLLs to be used in .NET 3.5 or earlier, with the first being for x86 and the second for x64 versions.

The second two are for registering DLLs to be used in .NET 4.0, again with the first being for x86 and the second for x64 versions.

With the release of .NET 4.0 the framework now has two GACs, this stackoverflow post explains why.

No comments:

Post a Comment