22

I have created a Console Application With Adding External Dll Ref.
Now i have to deploy my External Dll to my Assembly.
When i was trying to add my dll in GAC.

  GACUTIL.EXE /i MyLibrary.dll  

command to add my dll into Assembly , Its showing me error

*gacutil is not recognized as an internal or external comma*

how can i fix?

Kaps Hasija
  • 2,097
  • 5
  • 23
  • 31

5 Answers5

16

For Windows 10 path is: C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin

GorvGoyl
  • 42,508
  • 29
  • 229
  • 225
12

If you already installed Visual studio then you can use Developer Command Prompt instead of normal Command prompt to access the gacutil directly.

You can find Developer Command Prompt here:

Start Menu > Visual Studio 20XX > Developer Command Prompt for VS20XX

Hossein Rashno
  • 3,073
  • 1
  • 25
  • 49
  • Note: I need to use GacUtil becuase the IDE won't load...so this is Runnable IDE solution BUT not for Failure to Launch IDEs ;) – GoldBishop Apr 06 '23 at 15:55
4

Our Production Box running Windows Server 2016 does not have MS SDK tools for Global-Assembly cache (GAC)!!! So I copied the whole directory

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

from my Development laptop (Windows 10 that has VS 2017 installed) to that production server where I want to have my .dll's registered to my production server's Global Assembly.
copy GACUtil.exe from a dir to the other computer

The assemblies I need to register are : _Net35scannersMonitor.dll which is x86 dotNet 2.0 and _Net40scannersMonitor.dll which is x64 dotNet 4.x.

At the prompt of directory where my copied gacUtil is, I entered:

  gacutil -i D:\resource\Library\_Net35scannersMonitor.dll

and

  gacutil -i D:\resource\Library\_Net40scannersMonitor.dll

I used the same gacUtil.exe (file version 4.6.1055.0) to do both. And they both end up at the right place dotnet2x86(C:\Windows\assembly) and dotnet4(C:\Windows\Microsoft.NET\assembly\GAC_MSIL) -- I don't have to use 2 different gacUtil.exe's.

Result:

The x86 .dll and x64 .dll went to correct assembly respectively

Conclusion: Even your box has no VS installed, you can copy your gacutil.exe with its bin from the PC which has VS installed. No special download/install needed. Then you can use the copied gacutil for both x86 and x64 assemblies!!!

Jenna Leaf
  • 2,255
  • 21
  • 29
3

"But how can i deploy my dll on Client Server because he might don't have visual studio"

If I remember correctly, gacutil is also present in C:\windows\Microsoft.Net\some folder\

Another way: If using a primitive .cmd => You could bundle gacutil.exe and gacutil.exe.config along with your script.

Yet another way: If you are using windows installer, that has in built support for GACing assemblies.

Also, note that there are different GACs for x86 and x64 assemblies (ignore if your assembly is MSIL).

merlinbeard
  • 218
  • 1
  • 3
  • 14
3

probable duplicate : GAC 32bit vs. 64bit (gacutil is no more part of client OS since .Net 3.0 at least, you need to use a proper installer or to install the windows SDK which is clearly overkill)

Community
  • 1
  • 1
Michel
  • 282
  • 1
  • 4