130

I am using Windows 7 Enterprise 32 bit. I have used Windows command line, and also used VSTS 2008 command line, but when executing gacutil.exe, there is command not found error.

I am wondering whether I need to install gacutil.exe from somewhere or gacutil.exe is located in somewhere else in my computer (I searched my computer, but find several files called gacutil.exe, I do not know which one should be used)?

BTW: I am using .Net 3.5.

leppie
  • 115,091
  • 17
  • 196
  • 297
George2
  • 44,761
  • 110
  • 317
  • 455
  • See my answer at... http://stackoverflow.com/questions/25154024/visual-studio-2013-premium-solution-load-errors-after-update-3/34794625#34794625 – Dooie Jan 14 '16 at 16:27
  • 1
    You can simply [take](https://stackoverflow.com/a/62918985/2862241) three files: `gacutil.exe`, `gacutil.exe.config`, and `gacutlrc.dll` from a PC where `gacutil` is already installed. – Anton Shepelev Jul 15 '20 at 16:35

5 Answers5

162

gacutil comes with Visual Studio, not with VSTS. It is part of Windows SDK and can be download separately at http://www.microsoft.com/downloads/details.aspx?FamilyId=F26B1AA4-741A-433A-9BE5-FA919850BDBF&displaylang=en . This installation will have gacutil.exe included. But first check it here

C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin

you might have it installed.

As @devi mentioned

If you decide to grab gacutil files from existing installation, note that from .NET 4.0 is three files: gacutil.exe gacutil.exe.config and 1033/gacutlrc.dll

Alex Nolasco
  • 18,750
  • 9
  • 86
  • 81
Andrey
  • 59,039
  • 12
  • 119
  • 163
  • 7
    beware "only" a gig in size (the download) – roundcrisis Jul 15 '11 at 16:42
  • 4
    Here is the link to the .NET 4.0 download: http://www.microsoft.com/en-gb/download/details.aspx?id=8279 – Matt Wilko Feb 14 '14 at 16:47
  • 13
    if you decide to grab gacutil files from existing installation, note that from .NET 4.0 is three files: gacutil.exe gacutil.exe.config and 1033/gacutlrc.dll – gdbdable Mar 26 '14 at 09:38
  • 9
    And of course with 64 bit version of the OS the path is changed slightly, e.g. Windows 2012 Server it is under C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools – Dijkgraaf Aug 17 '15 at 21:16
84
  1. Open Developer Command prompt.
  2. type

where gacutil

nikita
  • 2,737
  • 2
  • 20
  • 26
  • 4
    Why does this have so many upvotes when the typical person who would be asking this question is the one who has to ask it because it isn't in an environment path :/ – Thomas Harris Mar 24 '20 at 11:57
  • 2
    @ThomasHarris The VS Developer Command Prompt will open with the environment correctly set, for that version of VS. – Falconne Sep 02 '20 at 19:55
  • Thomas, I have just upvoted him! I can't help it. – Jenna Leaf Jun 24 '21 at 14:04
10

On Windows 2012 R2, you can't install Visual Studio or SDK. You can use powershell to register assemblies into GAC. It didn't need any special installation for me.

Set-location "C:\Temp"
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
$publish = New-Object System.EnterpriseServices.Internal.Publish
$publish.GacInstall("C:\Temp\myGacLibrary.dll")

If you need to get the name and PublicKeyToken see this question.

9072997
  • 849
  • 7
  • 21
ritikaadit2
  • 171
  • 1
  • 10
6

You can use the version in Windows SDK but sometimes it might not be the same version of the .NET Framework your using, getting you the following error:

Microsoft (R) .NET Global Assembly Cache Utility. Version 3.5.21022.8 Copyright (c) Microsoft Corporation. All rights reserved. Failure adding assembly to the cache: This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

In .NET 4.0 you'll need to search inside Microsoft SDK v8.0A, e.g.: C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools (in my case I only have the 32 bit version installed by Visual Studio 2012).

Tiago Dias
  • 585
  • 1
  • 6
  • 12
  • 2
    Why does Microsoft bury this in such an obscure place? My Visual Studio 2010 had a short cut to the Command Prompt, but Visual Studio 2013 does have that, and there is no menu option in the IDE (under tools which is where I would expect it) to open up Command Prompt. It feels like the Visual Studio developer eco system has become kind of a mess. – Sam Goldberg Mar 03 '17 at 08:12
  • 1
    My instance of VS 2013 has it at Tools->Visual Studio Command Prompt. Have a look again. (I would never have thought to look there but for your suggestion, so thank you; hope this helps.) – Donald Locker Apr 24 '17 at 11:24
0

You can use gacutil from inside of the "Developer Command Prompt for VS [your version year]". If you use it from there, it's part of the path, so no need to find its location.

Searching "Developer Command Prompt" from the search bar in Windows should pop it up as the first option.

Jesse
  • 2,391
  • 14
  • 15