How to create a public assembly in GAC

类别:.NET开发 点击:0 评论:0 推荐:

How to Create a public Assembly and Install it in the GAC(Global Assembly Cache)

Step1: Create a DLL Assembly( win class library project).

Step 2: Create a strong name for the Assemly.  Sn – k keyName.snk

Setp3: Assign the key file to the assembly. In the AssemblyInfo.cs, change the Assembly:AssemblyKeyfile(“..\\..\\keyfile.snk”);

Step4: install the assembly to the GAC. Gacutil –I assemblyName.dll or drag and drop to c:\\winnt\\assembly

Step5: Uninstall a assembly from GAC, use gacutil /u (/ul, /uf) assemblyName. (Not need .DLL extention)

Step6:  How to use the assembly in GAC. First, using the namespace of the assembly namespace, secondly, directly use the class in the assembly.

 

Need to Improve

1 why system mention: Not fond snk file when I directly use “keyName.snk” instead of  “..\\..\\keyName.snk”

2 How to uninstall a assembly because always “uninstall fail because other applications use it”

3 how to reference the assembly in GAC. After I add a assembly to GAC, but I can’t reference it .

 

 

本文地址:http://com.8s8s.com/it/it43499.htm