简体   繁体   English

我在哪里可以找到 GACUtil?

[英]Where can I find GACUtil?

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

this is a list from where I was looking the exe without any success:这是我在没有任何成功的情况下查看 exe 的列表:

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

Thanks in advance.提前致谢。

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. GACUTIL -i filename 向 GAC 注册文件,但不一定将文件定位在 %windir%\\assembly 文件夹中。 This is a virtual folder controlled by SHFUSION.DLL which is a plugin windows explorer uses to display those files.这是一个由 SHFUSION.DLL 控制的虚拟文件夹,它是 Windows 资源管理器用来显示这些文件的插件。

Further Reading Here进一步阅读这里

If you can't simply type GACUTIL /?如果您不能简单地输入 GACUTIL /? from a cmd prompt.从 cmd 提示符。 You can navigate in windows to the assembly sub folder of windows dir and drag/drop the dll inside that folder.您可以在 windows 中导航到 windows dir 的程序集子文件夹,然后将 dll 拖放到该文件夹​​中。 You'll need to be an administrator of the pc to do this.您需要成为 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.在我的盒子上,我有 4 份……第一份在这儿。 C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\Bin\\NETFX 4.0 Tools\\x64 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.最有可能的问题是您没有在您尝试执行此操作的机器上安装 1.1 框架的框架 sdk。 You can download that here 你可以在这里下载

You can run GACUtil using the Visual Studio Command Prompt.您可以使用 Visual Studio 命令提示符运行 GACUtil。 The Visual Studio Command Prompt is automatically installed with Visual Studio. Visual Studio 命令提示符随 Visual Studio 自动安装。 To run the tool, use the Developer Command Prompt (or the Visual Studio Command Prompt in Windows 7).要运行该工具,请使用开发人员命令提示符(或 Windows 7 中的 Visual Studio 命令提示符)。 For more information, see Visual Studio Command Prompt .有关详细信息,请参阅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.在 Windows 8.1 中 - 在“开始”屏幕上,按 CTRL + TAB 打开应用列表,然后按 V。该列表将包含所有已安装的 Visual Studio 命令提示。 (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 徽标键 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.在 Windows 8 中 - 在“开始”屏幕上,按 Windows 徽标键 Windows 徽标 + Z。(要打开“开始”屏幕,请按键盘上的 Windows 徽标键 Windows 徽标。)选择屏幕底部的应用程序视图图标,然后然后按 V。该列表将包括所有已安装的 Visual Studio 命令提示。 Choose the Developer Command Prompt (or the command prompt you want to use).选择开发人员命令提示符(或您要使用的命令提示符)。

In Windows 7 - Choose Start, expand All Programs, and then expand Microsoft Visual Studio.在 Windows 7 中 - 选择开始,展开所有程序,然后展开 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.根据已安装的 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. 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 全局程序集缓存实用程序。 Version 4.0.30319.1 Copyright (c) Microsoft Corporation.版本 4.0.30319.1 版权所有 (c) Microsoft Corporation。 All rights reserved.版权所有。

Assembly successfully added to the cache程序集已成功添加到缓存

On Windows 2012 R2 Server, if you are not allowed to install Visual Studio or SDK,在 Windows 2012 R2 Server 上,如果不允许安装 Visual Studio 或 SDK,
you can use powershell to register assemblies into GAC.您可以使用 powershell 将程序集注册到 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")

C:\\Windows\\assembly This is the GAC but it only references where the assemblies actually reside. C:\\Windows\\assembly 这是 GAC,但它仅引用程序集实际所在的位置。 Being visible hereonly indicates registration with the GAC.在此处可见仅表示已向 GAC 注册。

If your is an enterprise application, you wouldn't have GacUtil on your Production box (assuming you are using Windows 2012 R2 or later).如果您的应用程序是企业应用程序,则您的 Production 机器上不会有 GacUtil(假设您使用的是 Windows 2012 R2 或更高版本)。 So, no point in using Gacutil to register assemblies into GAC.因此,使用 Gacutil 将程序集注册到 GAC 毫无意义。 You can use GacInstall and GacRemove methods as listed in other answers using powershell.您可以使用 powershell 使用其他答案中列出的 GacInstall 和 GacRemove 方法。 It worked for me.它对我有用。 It just took some time to figure out the exact syntax.只是花了一些时间来弄清楚确切的语法。

One simple way to get gacutil is to take it from a machine where it is already installed.获取gacutil一种简单方法是从已经安装了gacutil的机器上获取它。 You will need gacutil.exe and gacutil.exe.config from您将需要gacutil.exegacutil.exe.config来自

C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools\
(or analogous location)

and, gacutlrc.dll from the 1033 subdirectory.以及1033子目录中的gacutlrc.dll

Here , for example, is an archive with gacutil 4.0.30319.0 .例如, 这里是一个带有gacutil 4.0.30319.0 的存档。 It is a much leaner and simpler method of distribution than installing the huge Windows SDK with hundreds of files.与安装包含数百个文件的庞大Windows SDK相比,这是一种更精简、更简单的分发方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM