Home   Cover Cover Cover Cover
 

Strong name tool (sn.exe)

Question: see book

Answer: see 8.5.2 Strong Name Tool (sn.exe)

The following command line generates a public/private key pair:

sn /k mykeys.snk

After adding the attribute AssemblyKeyFile to the source code

MyLib.cs
using System.Reflection;

[assembly: AssemblyKeyFile("mykeys.snk")]

public class MyLib {
  public static int getTen () { return 10; }
}

the compiler will directly sign the resulting assembly.