How to: Sign an Assembly (Visual Studio)
Assembly signing (also called strong-name signing) gives an application or component a unique identity that other software can use to identify and refer explicitly to it. A strong name consists of its simple text name, version number, culture information (if provided), plus a public/private key pair. This information is stored in a key file; this can be a Personal Information Exchange (PFX) file or a certificate from the current user's Windows certificate store. For more information, see Strong-Name Signing for Managed Applications.
Note
This topic applies to Visual C# and Visual Basic projects only. For information about how to sign assemblies in Visual C++ projects, see Strong Name Assemblies (Assembly Signing) (C++/CLI).
For the purpose of assembly signing, Visual Studio supports only Personal Information Exchange (.pfx) and Strong Name Key (.snk) files stored in the project system on the local computer.
In some cases, you may only have access to a public key. If so, you can use delay signing to defer assigning the private key. For more information, see How to: Delay Sign an Assembly (Visual Studio).
You can sign your assembly using the options in the Signing page of the Project Designer as follows; for more information, see Signing Page, Project Designer.
The following procedures apply to signing the assembly only. If you want to sign the application and deployment manifests, see How to: Sign Application and Deployment Manifests.
To sign an assembly using a new key file
With the project node selected in Solution Explorer, from the Project menu, click Properties (or right-click the project node in Solution Explorer, and click Properties).
In the Project Designer, click the Signing tab.
Select the Sign the assembly check box.
Specify a new key file. In the Choose a strong name key file drop-down list, select <New...>. Note that new key files are always created in the .pfx format.
The Create Strong Name Key Dialog Box appears.
In the Create Strong Name Key dialog box, enter a name and password for the new key file, and then click OK.
Note
Optionally, you can enable delay signing by selecting the Delay sign only check box. For more information, see How to: Delay Sign an Assembly (Visual Studio).
To sign an assembly using an existing key file
With the project node selected in Solution Explorer, from the Project menu, click Properties (or right-click the project node in Solution Explorer, and click Properties).
In the Project Designer, click the Signing tab.
Select the Sign the assembly check box.
Specify an existing key file. In the Choose a strong name key file drop-down list, select <Browse...>.
In the Select File dialog box, navigate to the key file or enter its path in the File name box; then click Open to select it. (For more information, see How to: Create a Public/Private Key Pair.)
Note
You can change the password for the key file by clicking Change Password. In the Change Key Password Dialog Box, enter the old password, and then enter the new password twice.
Note
Optionally, you can enable delay signing by selecting the Delay sign only check box. For more information, see How to: Delay Sign an Assembly (Visual Studio).
See Also
Tasks
How to: Delay Sign an Assembly (Visual Studio)
Concepts
Strong-Name Signing for Managed Applications