Partilhar via


/keycontainer (C# Compiler Options)

Specifies the name of the cryptographic key container.

/keycontainer:string

Arguments

  • string
    The name of the strong name key container.

Remarks

When the /keycontainer option is used, the compiler creates a sharable component by inserting a public key from the specified container 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 when you compile this module into an assembly with /addmodule.

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.

For more information, see Creating and Using Strong-Named Assemblies and Delay Signing an Assembly.

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.

See Also

Tasks

How to: Modify Project Properties and Configuration Settings

Other Resources

C# Compiler Options