visual-studio 安装到 GAC 中的程序集物理存储在哪里?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/815362/
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
Where are assemblies installed into the GAC physically stored?
提问by Iralda Mitro
I want to export the assemblies built in my project. But where are they physically stored?
我想导出在我的项目中构建的程序集。但是它们物理存储在哪里?
回答by Iralda Mitro
I actually found this post, after i wrote my question. It's really good explained:
在我写下我的问题之后,我实际上找到了这篇文章。解释的真好:
You'll be able to see them if you navigate to
如果您导航到
c:\windows\assembly
c:\windows\assembly
with Explorer, where you'll see a nicely formatted list of assemblies.
The shell extension responsible for this view shows not just assemblies in the GAC, but also the native versions of assemblies pre-compiled with ngen.exe.
But the files aren't actually stored here - the shell extension simply masks their true location. You can see where the files are really stored by navigating to the same directory via a command prompt.
In this location are a number of subdirectories, including one named GAC. Buried here under several layers of hash codes and assembly names resides the physical assemblies, along with an old-fashioned .INI file that contains the strong name amongst other things. It's worth exploring in this uncharted territory just to understand what's going on under the covers, although beware of making changes as the GAC is intended to be opaque.
使用资源管理器,您将在其中看到格式良好的程序集列表。
负责此视图的外壳扩展不仅显示 GAC 中的程序集,还显示使用 ngen.exe 预编译的程序集的本机版本。
但是这些文件实际上并不存储在这里——shell 扩展只是掩盖了它们的真实位置。您可以通过命令提示符导航到同一目录来查看文件的实际存储位置。
在这个位置有许多子目录,包括一个名为 GAC 的子目录。隐藏在几层哈希代码和程序集名称下的是物理程序集,以及包含强名称等内容的老式 .INI 文件。在这个未知领域探索是值得的,只是为了了解幕后发生的事情,但要小心进行更改,因为 GAC 旨在不透明。
回答by Ed Guiness
They are stored in %systemroot% in a folder named assembly
它们存储在名为assembly的文件夹中的 %systemroot% 中
The %SystemRoot% variable is a special system-wide environment variable found on Microsoft Windows NT and its derivatives. Its value is the location of the system folder, including the drive and path.
%SystemRoot% 变量是一个特殊的系统范围的环境变量,可在 Microsoft Windows NT 及其衍生产品中找到。它的值是系统文件夹的位置,包括驱动器和路径。
The drive is the same as %SystemDrive% and the default path on a clean installation depends upon the version of the operating system. By default, on a clean installation:
该驱动器与 %SystemDrive% 相同,全新安装的默认路径取决于操作系统的版本。默认情况下,在全新安装中:
* Windows NT 5.1 (Windows XP) and newer versions use \WINDOWS
* Windows NT 5.0 (Windows 2000), Windows NT 4.0 and Windows NT 3.1 use \WINNT
* Windows NT 3.5x uses \WINNT35
(from wikipedia)
(来自维基百科)
回答by Andomar
The physical location of the GAC is the Assembly directory under %WINDIR%, f.e.
GAC的物理位置是%WINDIR%下的Assembly目录,fe
c:\windows\assembly
You can copy assemblies to the gac with Explorer, or the gacutil program.
您可以使用资源管理器或 gacutil 程序将程序集复制到 gac。
回答by Andomar
no, physically assemblies are stored not in "C:\Windows\assembly". only references to the assemblies are stored there. for example, assembly "System.Windows.Forms.dll" (as well as most part of .NET Framework assemblies) is physically stored in "C:\Windows\winsxs" in many editions, optimized for many platforms (just go to "C:\Windows\winsxs" in Explorer and type "System.Windows.Forms.dll" in the search box). for example, you may create strongly named assembly, register it to the GAC, but it's physical location is where you place the assembly file. (for example "C:\Users\%username%\Documents\Visual Studio 2008\Projects\YourAssemblyProjectName\YourAssemblyProjectName\bin\Debug" - VS projects default directory). and more, in GAC is only references to assemblies are stored, so if you rebuild your assembly wich is registered in GAC, the assemblies wich are using your assembly, by referencing it from GAC, will also use a rebuilded verion of your assembly.
不,物理程序集不存储在“C:\Windows\assembly”中。只有对程序集的引用存储在那里。例如,程序集“System.Windows.Forms.dll”(以及大部分 .NET Framework 程序集)在许多版本中物理存储在“C:\Windows\winsxs”中,针对多种平台进行了优化(只需转到“ C:\Windows\winsxs”并在搜索框中键入“System.Windows.Forms.dll”)。例如,您可以创建强命名程序集,将其注册到 GAC,但它的物理位置是您放置程序集文件的位置。(例如“C:\Users\%username%\Documents\Visual Studio 2008\Projects\YourAssemblyProjectName\YourAssemblyProjectName\bin\Debug” - VS 项目默认目录)。而且,在 GAC 中只存储对程序集的引用,

