-keycontainer (C# Compiler Options)
Specifies the name of the cryptographic key container.
The name of the strong name key container.
When the -keycontainer option is used, the compiler creates a sharable component. The compiler inserts a public key from the specified container into the assembly manifest and signs 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. This option is not supported when the compiler runs on CoreCLR. To sign an assembly when building on CoreCLR, use the -keyfile option.
You can also specify this option as a custom attribute (System.Reflection.AssemblyKeyNameAttribute) in the source code for any Microsoft intermediate language (MSIL) module.
You can also pass your encryption information to the compiler with -keyfile. Use -delaysign if you want the public key added to the assembly manifest but want to delay signing the assembly until it has been tested.
To set this compiler option in the Visual Studio development environment
- This compiler option is not available in the Visual Studio development environment.
You can programmatically access this compiler option with AssemblyKeyContainerName.