My gacutil.exe is missing! Again…
This is my second post regarding a missing Gacutil. This time it’s also for Windows Server 2008 / Vista / Windows 7 and Visual Studio 2008. It’s easier this time.
I often find myself using gacutil to add assemblies to GAC using postbuild events in Visual Studio. This is a fast and easy way of adding DLL’s to GAC, since you can’t just xcopy them.
I had a problem a while ago after setting up a new development virtual machine that I was missing gacutil. I solved that here, but the problem resurfaced when I switched to VS2008 and Windows Server 2008 (Actually I was just looking in the wrong folder… I’ll explain later…)
Visual Studio 2008 in Windows XP or Windows Server 2003
Gacutil.exe has always been and is still part of .NET SDKs. When developing with .NET 2.0 on an Windows XP or Windows Server 2003, then you get the gacutil.exe by installing the .NET 2.0 Framework SDK. Path is then:
C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\Gacutil.exe
When installing Visual Studio 2005 you do not get the .NET 2.0 SDK, and you have to download it manually.
I got this error when running my postbuild scripts before installing the .NET 2.0 SDK:
“c:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe is not recognized as an internal or external command”
Visual Studio 2008 in Windows Vista / Windows 7 / Windows Server 2008
When installing Visual Studio 2008 you no longer have to install the SDK manually. It will be installed for you. The location for gacutil.exe have changed though. If you can’t find it, maybe you are looking in the wrong directory now. There has been some changes to SDKs in the new operating systems, so you won’t just find the gacutil.exe in C:\Program Files\Microsoft Visual Studio 9\SDK\v3.5\Bin\Gacutil.exe.
The new location is:
C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\gacutil.exe
You can now add assemblies to gac using the following lines in your batch files
@SET GACUTIL=”C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\gacutil.exe”
Echo Installing mydll in GAC
%GACUTIL% -if bin\debug\mydllL.dll
If you still can’t use gacutil and instead get this error message:
Failure adding assembly to the cache: Access denied. You might not have administrative credentials to perform this task.
Contact your system administrator for assistance.
Then go here.
Related posts:
I’m using Windows 7 64-bit (RC1) with Visual Studio 2008, but I don’t have GACUtil.exe. In my variant of the prescribed folder, “C:\Program Files (x86)\Microsoft Visual Studio 9.0\SDK\v3.5\Bin”, I have things like “genasm.exe” but no “GACUtil.exe”. I ran the setup again but didn’t see any unchecked option for the SDK.
Hey Brian
That sounds a bit odd. Do you mean that you don’t have it in “C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\gacutil.exe”?
Also try and start up Visual Studio Command Prompt:
Start -> Programs -> Microsoft Visual Studio 2008 -> Visual Studio Tools and select Visual Studio 2008 Command Prompt.
Type gacutil in there. If it starts then it’s a matter of searching in Windows for it.
I have seen a ton that was missing it, and they all pretty much just searched in the wrong folder.
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin is the new location.