Using a key file
The public and private keys in a strong name key file (.snk file) are used to sign the assembly when you build your project in Visual Studio.
Strong-naming is used only with .NET Framework. It is not recommended for .NET 6 applications because these technologies do not use the GAC. |
If signing is not a concern for your application, you can ignore this feature. However, if your company needs to develop a policy for signing assemblies, you’ll need to create a key file and specify it when you create the assembly.
Depending on your workflow, you may want to use delayed signing. Delayed signing assigns the public key when the assembly is built, but enables you to delay the assignment of the private key until you are ready to distribute the assembly.
To use a key file
1. | Before generating C# classes, create an .snk file using Microsoft’s Strong Name tool, sn.exe, which is included in the .NET Framework. |
2. | If you are creating the assembly in Workbench, enter the name of your key file in the “Key file” field in the Component Information dialog box for your project. If you want to delay sign the assembly, also check the “Delay sign assembly” option. See Creating a Synergy/DE .NET Component project for details. |
3. | If you are creating the assembly from the command line, when you run gencs, specify the key file name with the -s option. If you want to delay sign the assembly, also specify the -t option. See Generating C# classes with gencs. |
For additional information on strong naming and delayed signing, and for instructions on using sn.exe to create a key file, see your .NET documentation.