◷ Reading Time: 2 minutes
Introduction
In some scenarios you would rather not to sign your assembly with any SNK key, but the environment license requires a unique identifier for you and your application. In this case, you can use an Assembly Private Name to assign an environment license to your application.
To avoid the strong name signing and in order to use an SNK for your identifier, as well as using an Assembly Private Name, you need to follow the steps below:
- Create an SNK file
- Extract the public key token
- Extract the public key file
- Generate a public key token from the public key file
- Send us the pubic key token and a list of the assemblies that have the Private Name embedded
- Create/Generate Assembly Private Name for each assembly using the same SNK file
- Add the Assembly Private Name to the AssemblyInfo.cs for each individual assembly
SNK
Generate SNK file
SNK files are a pair of public/private keys that allow you to sign your assembly. Also, these are required for the Assembly Private Name. To learn how to create an SNK file, please visit Microsoft website. In short, you can use sn.exe with the following format:
sn.exe -k snk-file-name
Extract Public Key Token
To extract your public key token, you need to first extract your public key from the SNK file.
sn -p snk-file-name public-key.snk
At that point, you can generate the public key token from your public key (i.e., public-key.snk)
sn -t public-key.snk