top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is Strong Name in .Net?

+3 votes
491 views

How to Sign an Assembly with a Strong Name?

posted Feb 18, 2014 by Khusboo

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+1 vote
 
Best answer

Strong name is basic important features of .Net. Strong names are used to identified a shared assembly uniquely. Prior to .Net assembly names were protected with the help COM by using a GUID.
However there were the chances to create the different object with the same name. Strong name has solved both the problem. It is divided into four parts as

Assembly name
Version number
A public key
and a culture.

It is used for cryptography purpose. strong name is mandatory for public assemblies before keeping them into GAC(Global Assembly Cache).

How to assign Strong Name:

You can assign strong name to your assemblies with the help of Sn.Exe. it will generate a key for you then you can assign that key to your Assembly.

"Sn –k keypair.snk"  

will generate a 1024 bit’s public –private key pair in keypair.snk. Now you just have to add these attributes to your assembly such as
using System.Reflection;

[assembly: AssemblyVersion("02.01.1.0")]
[assembly: AssemblyKeyFileAttribute("TestKey.snk")] 
answer Nov 20, 2014 by Manikandan J
0 votes

A strong name consists of the assembly's identity — its simple text name, version number, and culture information (if provided) — plus a public key and a digital signature.

The Windows Software Development Kit (SDK) provides several ways to sign an assembly with a strong name:

  • Using the Assembly Linker (Al.exe) provided by the Windows SDK.
  • Using assembly attributes to insert the strong name information in your code. You can use either the AssemblyKeyFileAttribute or the AssemblyKeyNameAttribute, depending on where the key file to be used is located.
  • Using compiler options such /keyfile or /delaysign in C# and Visual Basic, or the /KEYFILE or /DELAYSIGN linker option in C++. (For information on delay signing, see Delay Signing an Assembly.)
answer Feb 18, 2014 by Salil Agrawal
Similar Questions
+7 votes

How to create your own controls?
Basic steps will be helpful.

+2 votes

Is there any VB.NET equivalent to the C# var keyword?

+2 votes

Why is it preferred to not use finalize for clean up?

...