Strong Name is similar to GUID (It is supposed to be unique in space and time). In COM components. Strong name is only needed when we need to deploy assembly in GAC. Strong names help GAC to differentiate between two versions. Strong names use public key cryptography (PKC) to ensure that no one can spoof it. PKC use public key and private key concept. Following are the step to generate a strong name and sign an assembly:


 


Step1: Go to “Microsoft Visual Studio 2005” >>Visual Studio Tool>> Visual Studio Command prompt. This wills popup the command prompt for you.







   


Step2: After the command prompt run the strong tool from there


Sn.exe –k “c:\test.snk”


Here k: the key specifies that we want to generate the key.


test.snk: This file contains the key that is generated by the sn.exe tool


 





 


Step3: This will create the file at the following location. When you open the file that has been generated by the strong name tool. This is not a readable format because of security reasons.





Step4: Once the strong name key/value pair is generated using the strong name utility. We need to assign it to the project.






Step5: This will assign the strong name to this project. Then compile the project again to reflect the changes. The Strong Name is needed to insert the assembly into the GAC.


 


Add/Remove an assembly from GAC:


 


Here you can use other .Net tool to put the assembly in the GAC i.e. gacutil.exe


 


Go to “Microsoft Visual Studio 2005” >>Visual Studio Tool>> Visual Studio Command prompt >> gacutil.exe – i (assembly_name)


where assembly_name is the DLL name of the project.


To remove the assembly run this command. gacutil.exe – u (assembly_name)


 


                    

Dotnet Related Tutorials

...more

New Dotnet Resources

...more

Copyright © 2013 VisualBuilder. All rights reserved