sn -k "[驱动器号]:\[放置密钥的目录]\[密钥名称].snk"
sn -k "C:\GACKey\GACkey.snk"
[assembly:AssemblyKeyFile("C:\\GACKey\\GACKey.snk")]
通过按 CTRL+SHIFT+B 来编译项目。您不必具有任何附加代码即可以在 GAC 中安装 .dll 文件。gacutil -I "[驱动器号]:\[VS 项目中 Bin 目录的路径]\gac.dll"
如果您要拖动文件,请使用 Microsoft Windows 资源管理器。打开 Windows 资源管理器的两个实例。在一个实例中,找到控制台项目的 .dll 文件输出的位置。在另一实例中,找到 c:\[SystemRoot]\Assembly。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: AssemblyProduct("")]
[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\. 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("")]
本文地址:http://com.8s8s.com/it/it44599.htm