Creating an assembly key file
The steps involved in adding an assembly to the GAC is not as simple as adding the assembly to a web application. Since all applications can access this library, some security precautions have been taken by Microsoft to ensure uniqueness, version protection, and code integrity. This is achieved by creating a strong name for your new assembly. A Strong Name consists of the assembly identity and also a public key and digital signature. To create a strong name, you use the syntax:
sn -k StrongNameFile.snk |
Adding StrongNameFile.snk entry and modifying the version in AssemblyInfo.cs
[assembly: AssemblyVersion("1.0.1.1")]
[assembly: AssemblyKeyFile("c:\\StrongNameFile.snk")]
Adding your assembly to your GAC
gacutil /i AssemblyFileName.dll
Adding your assembly machine.config
<assembly="AssemblyFileName,Version=0.0.0.0,Culture=neutral,PublicKeyToken=5edf592a9c40680c">
Using Shared Assembly
<%@Import Namespace="Ashis"%> |
Happy learning......
No comments:
Post a Comment