|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|
Specifies a key container name for a key pair to give an assembly a strong name.
The compiler creates the sharable component by inserting a public key into the assembly manifest and by signing the final assembly with the private key. To generate a key file, type sn -k file at the command line. The -i option installs the key pair into a container. For more information, see Strong Name Tool (Sn.exe).
If you compile with /target:module, the name of the key file is held in the module and incorporated into the assembly that is created when you compile an assembly with /addmodule.
You can also specify this option as a custom attribute (AssemblyKeyNameAttribute) in the source code for any Microsoft intermediate language (MSIL) module.
See Creating and Using Strong-Named Assemblies for more information on signing an assembly.
The /keycontainer option is not available from within the Visual Studio development environment; it is available only when compiling from the command line.
The following code compiles source file Input.vb and specifies a key container.
vbc /keycontainer:key1 input.vb