C# gacutil 未被识别为内部或外部命令?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12386352/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
gacutil is not recognized as an internal or external command?
提问by Kaps Hasija
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.
我创建了一个添加外部 Dll 引用的控制台应用程序。
现在我必须将我的外部 Dll 部署到我的程序集。
当我试图在 GAC 中添加我的 dll 时。
GACUTIL.EXE /i MyLibrary.dll
command to add my dll into Assembly , Its showing me error
命令将我的 dll 添加到 Assembly 中,它显示了我的错误
*gacutil is not recognized as an internal or external comma*
how can i fix?
我该如何解决?
采纳答案by merlinbeard
"But how can i deploy my dll on Client Server because he might don't have visual studio"
“但是我如何在客户端服务器上部署我的 dll,因为他可能没有 Visual Studio”
If I remember correctly, gacutil is also present in C:\windows\Microsoft.Net\some folder\
如果我没记错的话,gacutil 也存在于 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.
另一种方式:如果使用原始 .cmd => 您可以将 gacutil.exe 和 gacutil.exe.config 与您的脚本捆绑在一起。
Yet another way: If you are using windows installer, that has in built support for GACing assemblies.
另一种方式:如果您使用的是 Windows 安装程序,则它内置了对 GACing 程序集的支持。
Also, note that there are different GACs for x86 and x64 assemblies (ignore if your assembly is MSIL).
另请注意,x86 和 x64 程序集有不同的 GAC(如果您的程序集是 MSIL,请忽略)。
回答by Michel
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)
可能重复:GAC 32 位与 64 位(至少从 .Net 3.0 起,gacutil 不再是客户端操作系统的一部分,您需要使用适当的安装程序或安装 Windows SDK,这显然是矫枉过正)
回答by JerryGoyal
For Windows 10path is: C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin
对于Windows 10路径是: C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin
回答by Hossein Rashno
If you already installed Visual studio then you can use Developer Command Promptinstead of normal Command promptto access the gacutildirectly.
如果您已经安装了 Visual Studio,那么您可以使用Developer Command Prompt而不是普通Command prompt来gacutil直接访问。
You can find Developer Command Prompthere:
你可以在Developer Command Prompt这里找到:
Start Menu > Visual Studio 20XX > Developer Command Prompt for VS20XX
Start Menu > Visual Studio 20XX > Developer Command Prompt for VS20XX
回答by Jenna Leaf
Our Production Box running Windows Server 2016 does not have MS SDK tools for Global-Assembly cache (GAC)!!! So I copied the whole directory
我们运行 Windows Server 2016 的 Production Box 没有用于 Global-Assembly 缓存 (GAC) 的 MS SDK 工具!!!所以我复制了整个目录
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.
从我的开发笔记本电脑(安装了 VS 2017 的 Windows 10)到我想要将我的 .dll 注册到我的生产服务器的全局程序集的生产服务器。
The assemblies I need to register are : _Net35scannersMonitor.dll which is x86 dotNet 2.0 and _Net40scannersMonitor.dll which is x64 dotNet 4.x.
我需要注册的程序集是:_Net35scannersMonitor.dll(x86 dotNet 2.0)和_Net40scannersMonitor.dll(x64 dotNet 4.x)。
At the prompt of directory where my copied gacUtil is, I entered:
在我复制的 gacUtil 所在目录的提示下,我输入:
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.
我使用相同的 gacUtil.exe(文件版本 4.6.1055.0)来完成这两项工作。他们都在正确的地方 dotnet2x86(C:\Windows\assembly) 和 dotnet4(C:\Windows\Microsoft.NET\assembly\GAC_MSIL) —— 我不必使用 2 个不同的 gacUtil.exe。
Result:
结果:
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!!!
结论:即使您的机器没有安装 VS,您也可以从安装了 VS 的 PC 上复制您的 gacutil.exe 及其 bin。无需特殊下载/安装。然后您可以将复制的 gacutil 用于 x86 和 x64 程序集!!!

