To create a key pair
•At the command prompt, type the following command:
sn –k
In this command, file name is the name of the output file containing the key pair.
The following example creates a key pair called sgKey.snk.
Copy
sn -k sgKey.snk
If you are using an IDE, such as Visual Studio .NET, to sign an assembly with a strong name, you must understand where the IDE looks for the key file.
For example, Visual Basic .NET looks for the key file in the directory containing the Visual Studio Solution, whereas the C# compiler looks for the key file
in the directory containing the binary. Put the key file in the appropriate project directory and set the file attribute as follows:
VB
[C#][assembly: AssemblyKeyFileAttribute(@"..\..\key.snk")]
No comments:
Post a Comment