.net 如何查看GAC中的文件夹和文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9498234/
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
How to view the Folder and Files in GAC?
提问by Rohit Vipin Mathews
I want to view the folders and sub folders in GAC. Also want to know about adding and removing from GAC.
我想查看GAC 中的文件夹和子文件夹。还想了解有关在GAC 中添加和删除的信息。
To install we write this lines in command prompt by opening Visual Studio command prompt:-
要安装,我们通过打开Visual Studio command prompt以下命令在命令提示符中写入以下行 :-
gacutil /i [assembly path]
gacutil /i [assembly path]
But to uninstall we need only:-
但是要卸载我们只需要:-
gacutil /u [assembly name]
gacutil /u [assembly name]
Why?
为什么?
回答by sll
Install:
安装:
gacutil -i "path_to_the_assembly"
View:
看法:
Open in Windows Explorer folder
在 Windows 资源管理器文件夹中打开
- .NET 1.0 - NET 3.5:
c:\windows\assembly(%systemroot%\assembly) - .NET 4.x:
%windir%\Microsoft.NET\assembly
- .NET 1.0 - NET 3.5:
c:\windows\assembly(%systemroot%\assembly) - .NET 4.x:
%windir%\Microsoft.NET\assembly
OR gacutil –l
或者 gacutil –l
When you are going to install an assembly you have to specify where gacutilcan find it, so you have to provide a full path as well. But when an assembly already is in GAC - gacutilknow a folder path so it just need an assembly name.
当您要安装程序集时,您必须指定gacutil可以找到它的位置,因此您还必须提供完整路径。但是当一个程序集已经在 GAC 中时 -gacutil知道一个文件夹路径,所以它只需要一个程序集名称。
MSDN:
微软:
回答by Rakuen42
I'm a day late and a dollar short on this one. If you want to view the folder structure of the GAC in Windows Explorer, you can do this by using the registry:
我迟到了一天,还差了一美元。如果要在 Windows 资源管理器中查看 GAC 的文件夹结构,可以使用注册表来执行此操作:
- Launch regedit.
- Navigate to HKLM\Software\Microsoft\Fusion
- Add a DWORD called DisableCacheViewer and set the value to 1.
- 启动注册表。
- 导航到 HKLM\Software\Microsoft\Fusion
- 添加一个名为 DisableCacheViewer 的 DWORD 并将值设置为 1。
For a temporary view, you can substitute a drive for the folder path, which strips away the special directory properties.
对于临时视图,您可以用驱动器代替文件夹路径,这会去除特殊的目录属性。
- Launch a Command Prompt at your account'sprivilege level.
- If you elevate your privileges, you might not see the drive in Windows 7.
- Type SUBST Z: C:\Windows\assembly
- Z can be any free drive letter.
- Open My Computer and look in the new substitute directory.
- To remove the virtual drive from Command Prompt, type SUBST Z: /D
- 在您帐户的权限级别启动命令提示符。
- 如果您提升权限,您可能在 Windows 7 中看不到该驱动器。
- 键入 SUBST Z:C:\Windows\assembly
- Z 可以是任何可用的驱动器号。
- 打开我的电脑并查看新的替代目录。
- 要从命令提示符中删除虚拟驱动器,请键入 SUBST Z: /D
As for why you'd want to do something like this, I've used this trick to compare GAC'd DLLs between different machines to make sure they're truly the same.
至于为什么你想要做这样的事情,我已经使用这个技巧来比较不同机器之间的 GAC DLL,以确保它们真的相同。
回答by Julius Kunze
Launch the program "Run" (Windows Vista/7/8: type it in the start menu search bar) and type:
C:\windows\assembly\GAC_MSIL
启动程序“运行”(Windows Vista/7/8:在开始菜单搜索栏中输入)并输入:
C:\windows\assembly\GAC_MSIL
Then move to the parent folder (Windows Vista/7/8: by clicking on it in the explorer bar) to see all the GAC files in a normal explorer window. You can now copy, add and remove files as everywhere else.
然后移动到父文件夹(Windows Vista/7/8:通过在资源管理器栏中单击它)以在普通资源管理器窗口中查看所有 GAC 文件。您现在可以像在其他任何地方一样复制、添加和删除文件。
回答by Klaus Byskov Pedersen
回答by Christian.K
You install as assemblies by using:
您可以使用以下命令作为程序集安装:
- A setup program, that you author for your application.
- Using the
gacutil.exetool with the-ioption from the command line. - Dropping the assembly in
%windir%\Assembly(only up to .NET 3.5, CLR 2.0)
- 您为应用程序编写的安装程序。
- 使用
gacutil.exe带有-i命令行选项的工具。 - 将程序集放入
%windir%\Assembly(仅限 .NET 3.5、CLR 2.0)
You view the content of the GAC using:
您可以使用以下方式查看 GAC 的内容:
- The
gacutil.exetool with the-loption. - For .NET 2.0, 3.0 and 3.5 (CLR 2.0) browsing to
%windir%\assemblyusing the Windows Explorer.
gacutil.exe带有-l选项的工具。- 对于 .NET 2.0、3.0 和 3.5 (CLR 2.0) 浏览到
%windir%\assembly使用 Windows 资源管理器。
Note that the (physical) GAC location has changed for .NET 4.0. It is no longer in %windir%\Assembly, but now in %windir%\Microsoft.NET\assembly. However, you should never write any code that depends on the physical location anyway, because given the tools available that is hardly necessary (some "cool" homegrown system diagnostics tools aside).
请注意,.NET 4.0 的(物理)GAC 位置已更改。它不再是%windir%\Assembly,而是现在%windir%\Microsoft.NET\assembly。但是,无论如何,您都不应该编写任何依赖于物理位置的代码,因为考虑到几乎不需要的可用工具(除了一些“很酷”的本地系统诊断工具)。

