|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
/KEYCONTAINER (Specify a Key Container to Sign an Assembly)
- Container that contains the key. Place the string in double quotation marks (" ") if it contains a space.
The linker creates a signed assembly by inserting a public key into the assembly manifest and signing the final assembly with the private key. To generate a key file, type sn -k file at the command line. sn -i installs the key pair into a container.
If you compile with /clr:noAssembly, the name of the key file is held in the module and incorporated into the assembly that is created when you compile an assembly that includes an explicit reference to the module, via #using, or when linking with /ASSEMBLYMODULE.
You can also specify this option as a custom attribute (System.Reflection.AssemblyKeyNameAttribute) in the source code for any MSIL module.
See Creating and Using Strong-Named Assemblies for more information on signing an assembly.
Other linker options that affect assembly generation are:
To set this linker option in the Visual Studio development environment
- Open the project's Property Pages dialog box. For details, see Setting Visual C++ Project Properties.
- Click the Linker folder.
- Click the Command Line property page.
- Type the option into the Additional Options box.
To set this linker option programmatically