.net 我在哪里可以找到 GACUtil?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9726035/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 16:18:46  来源:igfitidea点击:

Where can I find GACUtil?

.netdllgac

提问by Leonardo Raygoza

I know there have been many people asking the same thing, I have read all the posts related, but I couldn't find the gacutil.exe, I was looking at C:\WINDOWS\microsoft.net\Framework\v1.1.4322 and I found gacutil.exe.config but obviously it is just the config file. I need include a dll in the GAC.

我知道有很多人在问同样的事情,我已经阅读了所有相关的帖子,但是我找不到 gacutil.exe,我正在查看 C:\WINDOWS\microsoft.net\Framework\v1.1.4322 和我找到了 gacutil.exe.config 但显然它只是配置文件。我需要在 GAC 中包含一个 dll。

this is a list from where I was looking the exe without any success:

这是我在没有任何成功的情况下查看 exe 的列表:

  • C:\Program Files\Microsoft.NET
  • C:\WINDOWS\microsoft.net\Framework\v1.1.4322
  • C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin
  • C:\Program Files\Microsoft.NET
  • C:\WINDOWS\microsoft.net\Framework\v1.1.4322
  • C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin

Thanks in advance.

提前致谢。

回答by William Dwyer

You can find the GAC in any windows box under C:\windows\assembly\

您可以在 C:\windows\assembly\ 下的任何窗口框中找到 GAC

or %windir%\assembly

或 %windir%\assembly

GACUTIL -i filename registers the file with the GAC but doesn't necessarily locate the file inside the %windir%\assembly folder. This is a virtual folder controlled by SHFUSION.DLL which is a plugin windows explorer uses to display those files.

GACUTIL -i filename 向 GAC 注册文件,但不一定将文件定位在 %windir%\assembly 文件夹中。这是一个由 SHFUSION.DLL 控制的虚拟文件夹,它是 Windows 资源管理器用来显示这些文件的插件。

Further Reading Here

进一步阅读这里

If you can't simply type GACUTIL /? from a cmd prompt. You can navigate in windows to the assembly sub folder of windows dir and drag/drop the dll inside that folder. You'll need to be an administrator of the pc to do this.

如果您不能简单地输入 GACUTIL /? 从 cmd 提示符。您可以在 windows 中导航到 windows dir 的程序集子文件夹,然后将 dll 拖放到该文件夹​​中。您需要成为 PC 的管理员才能执行此操作。

Typically to access this utility I fire up the VS 2010 Command Prompt as it has the appropriate %PATH% variable settings to locate the gacutil cmd.

通常要访问此实用程序,我会启动 VS 2010 命令提示符,因为它具有适当的 %PATH% 变量设置来定位 gacutil cmd。

On my box, I have 4 copies... First one is located here. C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\x64

在我的盒子上,我有 4 份……第一份在这儿。C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\x64

The issue most likely is that you don't have the framework sdk for the 1.1 framework installed on the box you're trying to do this on. You can download that here

最有可能的问题是您没有在您尝试执行此操作的机器上安装 1.1 框架的框架 sdk。 你可以在这里下载

回答by Cynthia C

You can run GACUtil using the Visual Studio Command Prompt. The Visual Studio Command Prompt is automatically installed with Visual Studio. To run the tool, use the Developer Command Prompt (or the Visual Studio Command Prompt in Windows 7). For more information, see Visual Studio Command Prompt.

您可以使用 Visual Studio 命令提示符运行 GACUtil。Visual Studio 命令提示符随 Visual Studio 自动安装。要运行该工具,请使用开发人员命令提示符(或 Windows 7 中的 Visual Studio 命令提示符)。有关详细信息,请参阅Visual Studio 命令提示符

In Windows 8.1 - On the Start screen, press CTRL + TAB to open the Apps list and then press V. The list will include all installed Visual Studio command prompts. (To open the Start screen, press the Windows logo key Windows logo on your keyboard.) Choose the Developer Command Prompt (or the command prompt you want to use).

在 Windows 8.1 中 - 在“开始”屏幕上,按 CTRL + TAB 打开应用程序列表,然后按 V。该列表将包含所有已安装的 Visual Studio 命令提示。(要打开“开始”屏幕,请按键盘上的 Windows 徽标键 Windows 徽标。)选择开发人员命令提示符(或您要使用的命令提示符)。

In Windows 8 - On the Start screen, press the Windows logo key Windows logo + Z. (To open the Start screen, press the Windows logo key Windows logo on your keyboard.) Choose the Apps view icon at the bottom of the screen and then press V. The list will include all installed Visual Studio command prompts. Choose the Developer Command Prompt (or the command prompt you want to use).

在 Windows 8 中 - 在“开始”屏幕上,按 Windows 徽标键 Windows 徽标 + Z。(要打开“开始”屏幕,请按键盘上的 Windows 徽标键 Windows 徽标。)选择屏幕底部的应用程序视图图标,然后然后按 V。该列表将包括所有已安装的 Visual Studio 命令提示。选择开发人员命令提示符(或您要使用的命令提示符)。

In Windows 7 - Choose Start, expand All Programs, and then expand Microsoft Visual Studio. Depending on the version of Visual Studio you have installed, choose Visual Studio Tools, Visual Studio Command Prompt, or the command prompt you want to use.

在 Windows 7 中 - 选择开始,展开所有程序,然后展开 Microsoft Visual Studio。根据已安装的 Visual Studio 版本,选择 Visual Studio 工具、Visual Studio 命令提示符或要使用的命令提示符。

GACUtil info: https://msdn.microsoft.com/en-us/library/ex0ss12c(v=vs.110).aspx

GACUtil 信息:https://msdn.microsoft.com/en-us/library/ex0ss12c(v =vs.110).aspx

Example commands:

示例命令:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>cd C:\Windows\Microsoft.N et\assembly\GAC_MSIL\elite.eai.importsvc.generic.fm\v4.0_2.4.3.0__f659f54317ad7e 73\

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>cd C:\Windows\Microsoft.N et\assembly\GAC_MSIL\elite.eai.importsvc.generic.fm\v4.0_2.4.3.0__f659f54317ad7e 73\

C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Elite.EAI.ImportSvc.Generic.FM\v4.0_2 .4.3.0__f659f54317ad7e73>gacutil.exe /i "elite.eai.importsvc.generic.fm.dll" Microsoft (R) .NET Global Assembly Cache Utility. Version 4.0.30319.1 Copyright (c) Microsoft Corporation. All rights reserved.

C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Elite.EAI.ImportSvc.Generic.FM\v4.0_2 .4.3.0__f659f54317ad7e73>gacutil.exe /i "elite.eai.importsvc.generic.fm.dll" Microsoft (R) .NET 全局程序集缓存实用程序。版本 4.0.30319.1 版权所有 (c) Microsoft Corporation。版权所有。

Assembly successfully added to the cache

程序集已成功添加到缓存

回答by ritikaadit2

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

在 Windows 2012 R2 Server 上,如果不允许安装 Visual Studio 或 SDK,
可以使用 powershell 将程序集注册到 GAC。它对我来说不需要任何特殊安装。

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")

回答by PTiddy

C:\Windows\assembly This is the GAC but it only references where the assemblies actually reside. Being visible hereonly indicates registration with the GAC.

C:\Windows\assembly 这是 GAC,但它仅引用程序集实际所在的位置。在此处可见仅表示已向 GAC 注册。

回答by ritikaadit2

If your is an enterprise application, you wouldn't have GacUtil on your Production box (assuming you are using Windows 2012 R2 or later). So, no point in using Gacutil to register assemblies into GAC. You can use GacInstall and GacRemove methods as listed in other answers using powershell. It worked for me. It just took some time to figure out the exact syntax.

如果您的应用程序是企业应用程序,则您的 Production 机器上不会有 GacUtil(假设您使用的是 Windows 2012 R2 或更高版本)。因此,使用 Gacutil 将程序集注册到 GAC 毫无意义。您可以使用 powershell 使用其他答案中列出的 GacInstall 和 GacRemove 方法。它对我有用。只是花了一些时间来弄清楚确切的语法。