Export (0) Print
Expand All

/keycontainer

Specifies a key container name for a key pair to give an assembly a strong name.

/keycontainer:container

-or-

/keycontainer:"container"

Arguments

container
Required. Container that contains the key. Place the string in double quotation marks (" ") if it contains a space.

Remarks

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.

You can also pass your encryption information to the compiler with /keyfile. Use /delaysign if you want a partially signed assembly.

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.

Example

The following code compiles source file input.vb and specifies a key container:

vbc /keycontainer:key1 input.vb

See Also

Assemblies | Visual Basic Compiler Options | /keyfile | Sample Compilation Command Lines

Show:
© 2014 Microsoft