strong name in gac

本文介绍了.NET程序中强命名的概念及其重要性,并详细讲解了如何为程序集创建强命名密钥对,以及如何将带有强命名的程序集安装到全局程序集缓存(GAC)中。
After creating an assembly and before registering it to the Global Assembly Cache the first thing that is required is to assign a strong name to the assembly. What is a strong name? Well! a strong name is basically assigned to an assembly or a component to distinguish it from other assemblies and components existing in the GAC. A strong name consists of an assembly identity (name, version, etc.), public key and a digital signature. The Global Assembly Cache is used to share assemblies throughout applications. For example, to create a strong name for an assembly named as sample.dll, you would write on the command prompt. sn -k sample.snk This would generate a strong name key pair and store it in a file named as sample.snk. The extension of the file can be anything, but mostly .snk is used as a convention. The -k option here is for creating a strong name key pair. There are other options also available which you could search for in MSDN. After generating the strong name key pair file, it is required to associate this file with our assembly, for doing that you have to add the following lines in the code of your assembly. Imports System.Reflection Note here that the information regarding the file containing the strong name key pair is placed in the code file before the namespace declaration. Also you are required to import the System.Reflection namespace in order for the statement to work, otherwise the compiler would be showing you an error stating that it does not recognize the statement. After compiling the assembly with the statements, containing the strong name information being added to it, you now have to place the assembly into the GAC. You can either do it manually by simply copying and pasting the assembly into the GAC, which is located at c:\winnt\assembly; or use gacutil , gacutil /i sample.dll please refer to below link for more info, http://aspalliance.com/394_Installing_an_Assembly_in_GAC

转载于:https://www.cnblogs.com/oflying907/archive/2010/04/02/1702881.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值