Wednesday, 15 July 2015

Using Gacutil on a Non-Development Server

A short while ago I came across an issue with using the Visual Studio gacutil tool on a non-development server. By non-development server, I mean a system which does not have Visual Studio installed on it with the associated .NET Software Development Kit (SDK). I thought it may be useful to share the problem and solution here in case anyone else runs into the same issue.

The gacutil tool is part of the Visual Studio SDK and is used to install a strongly named assembly to the Global Assembly Cache (GAC). In my case, I had written a .NET 4 class library which was to be consumed by an application which lives on the same machine. As part of my deployment testing, I used the gacutil tool through the Visual Studio Developer Command Prompt to install the assembly in my local GAC. The result was successful as shown in the screenshot below.


I then had to install the same class library in the GAC of a test server. The test server had .NET Framework version 4 installed but because it doesn't have Visual Studio installed, it did not have the Developer Command Prompt and gacutil on the server. I then located the gacutil.exe and gacutil.exe.config files from my laptop file system, the location in my case was:

C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools

I copied the gacutil.exe and gacutil.exe.config files onto the test server and opened command prompt (cmd.exe) as administrator. Running the gacutil install command yielded no success response from gacutil, as shown in the screenshot below.


Surprisingly, gacutil gave no feedback as to what happened. After doing a bit of online research, I learned that gacutil has a dependency on a dll file named "gacutlrc.dll". In my laptop file system, I found this dependency in the folder location:

C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\1033

I then created a folder named "1033" in the same directory that I copied gacutil.exe to on my test server. I copied the "gacutlrc.dll" file into the 1033 folder and executed the gacutil install command with a successful result.

In summary, if you are using the gacutil command on a non-development server, ensure you have the following in a single folder:
  • gacutil.exe and gacutil.exe.config
  • a folder named "1033" with the gacutlrc.dll file within it
It should then just be a case of opening a command prompt window as an administrator, navigating to the directory containing gacutil.exe and running the gacutil /i [path to assembly] command.