Assembly private name

From FlexRule Wiki
Jump to: navigation, search


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:

  1. Create an SNK file
  2. Extract the public key token
    1. Extract the public key file
    2. Generate a public key token from the public key file
  3. Send us the pubic key token and a list of the assemblies that have the Private Name embedded
  4. Create/Generate Assembly Private Name for each assembly using the same SNK file
  5. Add the Assembly Private Name to the AssemblyInfo.cs for each individual assembly


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

Private Assembly Utility

In your FlexRule Runtime location, open a command line and type the command below:

FlexRule.Tester.exe -sign

Similar to the picture below:


and the following window will appear:


Embed Assembly Private Name

To sign your assembly using Assembly Private Name, please follow the steps below:

  1. Build your assembly without any change, just like a normal assembly
  2. Run the assembly private name utility (FlexRule.Tester.exe -sign)
  3. Browse your assembly
  4. Browse your SNK file
  5. Press the Generate button
  6. The utility will generate a code in the bottom section. Just copy and paste it into the Assembly.Info.cs class file of your project
  7. Rebuild your assembly


Please note, if your assembly name changes, you will need to re-generate your Assembly Private Name.