Specifies a key container name for a key pair to give an assembly a strong name.
- Required. Container that contains the key. Place the string in double quotation marks (" ") if it contains a space.
The compiler creates the sharable component 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 /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 (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.
This option is not available within the development environment.
To set /keycontainer programmatically
- See AssemblyKeyContainerName Property and the AssemblyOriginatorKeyMode Property.
The following code compiles source file
input.vb and specifies a key container:
vbc /keycontainer:key1 input.vb