内容简介:GAC 与其物理路径
GAC (Global Assembly Cache) 是 .NET 框架下程序集(Assembly)的一个全局缓存。不同 CLR (Common Language Runtime, 公共语言运行时) 版本,不同平台的程序集会被缓存在不同路径下。
| CLR 版本 | 对应 .NET 版本 | 程序集平台 | -> | 缓存位置 |
|---|---|---|---|---|
| 1.0 | 1.0 | - | -> |
%windir%\assembly\GAC
|
| 1.1 | 1.1 | -> | ||
| 2.0 | 2.0/3.0/3.5 | Win32 | -> |
%windir%\assembly\GAC_32
|
| x64 | -> |
%windir%\assembly\GAC_64
|
||
| Any CPU | -> |
%windir%\assembly\GAC_MSIL
|
||
| 4 | 4.x (4.0-4.7) | Win32 | -> |
%windir%\Microsoft.NET\assembly\GAC_32
|
| x64 | -> |
%windir%\Microsoft.NET\assembly\GAC_64
|
||
| Any CPU | -> |
%windir%\Microsoft.NET\assembly\GAC_MSIL
|
GAC 的访问顺序
当程序集(Assembly)要从 GAC 中加载依赖时,会根据自己的平台(32 位或 64 位)首先尝试加载 GAC_32 或 GAC_64 下的程序集,随后尝试 GAC_MSIL ,如果在这其中都没能找到,则会尝试 GAC 。
如果依赖的程序集没有在 GAC 中找到,那么还会依次尝试依赖者所在的当前目录以及环境变量 PATH
中的目录。
GAC 目录下的其他文件夹
关于 GAC,我们有如下目录结构:
%windir%
├── assembly
│ ├── GAC
│ ├── GAC_32
│ ├── GAC_64
│ ├── GAC_MSIL
│ ├── NativeImages_v2.0.50727_32
│ ├── NativeImages_v2.0.50727_64
│ ├── NativeImages_v4.0.30319_32
│ ├── NativeImages_v4.0.30319_64
│ ├── temp
│ └── tmp
└── Microsoft.NET
└── assembly
├── GAC_32
├── GAC_64
└── GAC_MSIL
其中 NativeImages
目录下包含了已经通过 Ngen.exe
编译成原生代码的程序集。
tmp
目录则是用做程序集安装至 GAC 之前的一个临时目录, temp
目录则是程序集从 GAC 中卸载时所用的临时目录。
参考阅读(英文)
- .NET Framework - Wikipedia
- Global Assembly Cache | Microsoft Docs
- GAC, Assembly ProcessorArchitecture, and Probing – Junfeng Zhang's Musing
- GAC Temp and Tmp – Junfeng Zhang's Musing
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Usability for the Web
Tom Brinck、Darren Gergle、Scott D. Wood / Morgan Kaufmann / 2001-10-15 / USD 65.95
Every stage in the design of a new web site is an opportunity to meet or miss deadlines and budgetary goals. Every stage is an opportunity to boost or undercut the site's usability. Thi......一起来看看 《Usability for the Web》 这本书的介绍吧!