To markProgramYou must have a pair of public and private keys. Creating a key pair. The key file usually has a. SNK file extension.
● Create a key pair
At the command prompt, type the following command:
Sn-k <File Name>
In this command, <File Name> is the name of an output file containing the key pair.
The following example creates a key pair file named sgkey. SNK.
If you want to delay the identification assembly and control the entire key pair (unlike external test scenarios and scenarios), you can use the following command to generate a pair of key pairs, then, the Public Key is extracted from the key pair to a separate file.
First, create a key pair:
Then, extract the public key from the generated key pair file (keypair. SNK) and copy it to an independent file:
Sn-P keypair. SNK public. SNK |
Once you create a key pair, you must place the file in a position that can be found by the strong naming tool.
When a strong name is used to identify an assembly, assembly connector (Assembly Linker (al.exe) searches for key files related to the current directory and outputs them to the current directory. When compiling with the command line tool, you can easily copy this key toCodeThe current directory of the module.
If you are using vistual studio that does not have signature options in earlier versions of project properties, the recommended key file location is in the project directory where file attributes are defined as follows.
[Assembly: assemblykeyfileattribute ("Keyfile. SNK")] |
ArticleLink: [msdn] http://msdn.microsoft.com/en-us/library/6f05ezxy.aspx