当前位置:首页 » 文件管理 » 全局程序集缓存

全局程序集缓存

发布时间: 2022-01-25 18:24:00

1. 如何:在全局程序集缓存中安装程序集

将资源文件放到设备上的某个目录中。
创建一个文本文件,其中每行列出一个文件及其路径。
以 .gac 扩展名将该文本文件保存到设备的 Windows 目录中。
程序集文件可以是 ANSI 或 UTF-8 编码文件,但不支持其他 Unicode 编码。
以下是一个 MyDlls.gac 示例,它列出了三个要安装到全局程序集缓存中的文件:
\Program Files\MyApp\MyDll1.Dll
\Program Files\MyApp\MyDll2.Dll
\Program Files\MyApp\MyDll3.Dll
下次运行应用程序时,.NET Compact Framework 会将您在 .gac 文本文件中列出的文件移动到全局程序集缓存中。这些文件必须用强名称签名。目前不支持延迟签名。对 .gac 文本文件的任何更改将导致以下结果:
如果从 Windows 目录中删除 .gac 文本文件,则下次运行应用程序时将从全局程序集缓存中移除该文本文件中列出的文件。
如果更新 .gac 文本文件,则 .NET Compact Framework 将在全局程序集缓存中相应地更新该文件。
不能使用同一名称加载各个程序集。您必须更改 DLL 的名称,或在 DLL 具有强名称时,可将其放入全局程序集缓存中并使用具有完整强名称的Load方法。通过在桌面上打开命令行和使用

2. C#中如何将dll加入全局程序集缓存

安装 gacutil /i *.dll

查看 gacutil /l

移除 gacutil /u *

注:要在.NET Framework SDK 命令提示 下运行才可以

3. 全局程序集缓存

计算机范围内的代码缓存,它存储专门安装的程序集,这些程序集由计算机上的许多应用程序共享。在全局程序集缓存中部署的应用程序必须具有强名称。

.Net提供的命令行工具gacutil.exe用于支持这一功能。gacutil.exe可以将具有强名称的程序集添至全局程序集缓存。

4. 在“全集程序集缓存(GAC) ”中安装程序集Windows Base

关于这个问题,我说一下自己的建议

1.这不是你电脑的问题,是安装程序的问题
2.需要开发人员解决问题,方案如下:
英文版VS2008:打开工程选项-》publish->application file按钮 找到'stdole 将其状态改为include重新编译项目
中文版VS2008:项目(&P)-> ...属性(&P)-> 发布-> 应用程序文件(&I) 找到'stdole 将其状态改为include重新编译项目

5. 如何将程序集安装到全局程序集缓存中

您可以使用 Gacutil.exe 将强名称程序集添加到全局程序集缓存,并查看全局程序集缓存的内容。
注意Gacutil.exe 只用于开发,不应用于将产品程序集安装到全局程序集缓存中。
使用 Microsoft Windows Installer 2.0。
这是将程序集添加到全局程序集缓存的最常用方法,建议采用。此安装程序可提供全局程序集缓存中程序集的引用计数,还具有其他优点。
使用 .NET Framework SDK 提供的名为
程序集缓存查看器 (Shfusion.dll)

6. 如何在 Visual C#NET 中将程序集安装到全局程序集缓存中

要使用 Visual Studio .NET 创建小型类库项目、生成强名称,以及在 GAC 中安装项目的 .dll 文件,请按照下列步骤操作:
在 Visual Studio .NET 中,创建一个新 Visual C# .NET 类库项目,并将该项目命名为 GACDemo。
必须使用强名称。要生成此加密密钥对,请使用 SN 工具。此工具位于安装 .NET Framework 解决方案开发人员工具包 (SDK) 的 \bin 子目录中。SN 工具易于使用。命令行语句采用以下形式:
sn -k "[DriveLetter]:\[DirectoryToPlaceKey]\[KeyName].snk"
在 C:\ 中创建一个名为 GACKey 的目录,以便您可以轻松地找到密钥,并从命令提示符处访问该密钥。

注意:对于大多数用户,.NET 工具位于 C:\Program Files\Microsoft.NET\FrameworkSDK\Bin 中。键入以下 SN 命令前,可能需要在您的计算机上将与该路径类似的路径复制到 .NET bin 目录中。从命令提示符处键入 cd,右键单击以粘贴该路径,然后按 Enter,快速转至 SN 工具所在的目录。

键入以下内容:
sn -k "C:\GACKey\GACkey.snk"
将生成一个密钥,但是它与项目的程序集尚无关联。要建立此关联,请在 Visual Studio .NET 解决方案资源管理器中双击 AssemblyInfo.cs 文件。此文件具有一个程序集属性列表,默认情况下,在 Visual Studio .NET 中创建项目时将包括这些属性。在代码中修改“AssemblyKeyFile”程序集属性,如下所示:
[assembly:AssemblyKeyFile("C:\\GACKey\\GACKey.snk")]
通过按 Ctrl+Shift+B 来编译项目。您不必具有任何附加代码即可以在 GAC 中安装 .dll 文件。
您可以通过使用 Gacutil 工具或者通过将 .dll 文件拖至适当的目录来安装 .dll 文件。如果您使用 Gacutil 工具,则可以使用以下命令:
gacutil -I "[DriveLetter]:\[PathToBinDirectoryInVSProject]\gac.dll"
如果您要拖动文件,请使用 Microsoft Windows 资源管理器。打开 Windows 资源管理器的两个实例。在一个实例中,找到控制台项目的 .dll 文件输出的位置。在另一实例中,找到 c:\[SystemRoot]\Assembly。

将您的 .dll 文件拖到“Assembly”文件夹中。

完整代码列表 (AssemblyInfo.cs)

using System.Reflection;
using System.Runtime.CompilerServices;

//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// that is associated with an assembly.
//
[assembly: AssemblyTitle("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

//
// Version information for an assembly is made up of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values, or you can default the revision and build numbers
// by using the '*' as shown below:

[assembly: AssemblyVersion("1.0.*")]

//
// To sign your assembly you must specify a key to use. See the
// Microsoft .NET Framework documentation for more information about assembly signing.
//
// Use the following attributes to control that key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your computer. KeyFile refers to a file that contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed to the CSP and used.
// (*) To create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile must be
// relative to the project output directory which is
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
// located in the project directory, you would specify the AssemblyKeyFile
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information about this.
//
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("C:\\GACKey\\GACKey.snk")]
[assembly: AssemblyKeyName("")]
验证

启动 Windows 资源管理器。
找到 C:\SystemRoot\ 程序集。
在已安装的 .dll 文件的列表中,您会看到 GACDemo。

7. 无法安装或运行此应用程序,该应用程序要求首先在"全局程序集缓存(GAC)"中安装程序集,

不是你电脑的问题,是安装程序的问题
2.需要开发人员解决问题,方案如下:
英文版VS2008:打开工程选项-》publish->application file按钮 找到'stdole 将其状态改为include重新编译项目
中文版VS2008:项目(&P)-> ...属性(&P)-> 发布-> 应用程序文件(&I) 找到'stdole 将其状态改为include重新编译项目

8. 如何在全局程序集缓存中安装dll文件

dll文件在系统和软件中的重要作用会造成
1,不能正常运行某些应用程序,如游戏
2,系统不能正常运行,出现电脑蓝屏现象
3,系统的某些功能不能正常使用,如没有声音
4,桌面某些程序无法删除也是由于DLL文件在后台运行造成
5,用腾讯电脑管家的电脑诊所搜你缺失的dll文件,立即修复

热点内容
大便解压 发布:2024-10-19 04:27:53 浏览:41
linux查看网卡地址 发布:2024-10-19 04:18:01 浏览:711
流逝sql 发布:2024-10-19 04:13:39 浏览:26
三值存储器 发布:2024-10-19 04:05:47 浏览:284
弹簧解压 发布:2024-10-19 04:00:50 浏览:69
dma访问 发布:2024-10-19 03:50:47 浏览:598
linux缺页 发布:2024-10-19 03:50:45 浏览:760
清除无线缓存 发布:2024-10-19 03:36:14 浏览:959
逍遥3源码 发布:2024-10-19 03:15:50 浏览:189
opencv教程python 发布:2024-10-19 03:12:56 浏览:599