How to: Import and Apply Certificates in Device Projects

The Select Certificate dialog box is the central portal for signing device projects. It provides an entry to the Manage Certificates dialog box and the Certificate Import Wizard as described in the following steps.

Note

Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Visual Studio Settings.

Displaying the Select Certificate Dialog Box

How you access the Select Certificate dialog box depends on the type of project you want to sign.

To display the Select Certificate dialog box

  1. In Solution Explorer, right-click <Projectname>, and then click Properties.

  2. Continue by using one of the following procedures:

    • For Visual Basic and Visual C# projects: In the Project Designer, click Devices, select Authenticode Signature, and then click Select Certificate.

    • In Visual C++ projects, select Authenticode Signing, and then click the ellipsis button in the Certificate property row.

    • In Smart Device CAB projects, select Authenticode Signing, and then click Select from Store.

Selecting a Certificate for a Device Project

After you have displayed the Select Certificate dialog box as described in the previous steps, you can select the certificate you want.

To select a certificate for the project by using the Select Certificate dialog box

  • If the Select Certificate dialog box displays the certificate you want for the project, select the certificate, and then click OK.

    The project is signed with that certificate when the project is built.

  • If the Select Certificate dialog box does not display the certificate you want for the project, you can import a certificate by using the Certificate Import Wizard.

Importing a Certificate for a Device Project

The following steps show how to populate the Select Certificate dialog box by importing the test certificates provided by Visual Studio and applying them to a project. You can follow this same procedure if you want to apply a different certificate.

Visual Studio provides three user interface elements for the task of importing a certificate to apply to a project:

  • The Select Certificate dialog box, which specifies which certificates are to be applied to the current project.

  • The Manage Certificates dialog box, which lists the certificate files available on the development computer.

  • The Certificate Import Wizard, which guides you in selecting your certificate file and specifying where you want to store it.

To import a test certificate by using the Certificate Import Wizard

  1. In the Select Certificate dialog box, click Manage Certificates.

    The Manage Certificates dialog box displays a list of certificates stored on the development computer.

  2. Click Import to open the Certificate Import Wizard.

  3. Click Next to open the File to Import page of the wizard.

  4. Click Browse to navigate to the TestCertificates folder in Visual Studio.

    By default, this folder is at drive:\Program Files\Microsoft Visual Studio 9.0\SmartDevices\SDK\SDKTools.

  5. Change the Files of Type selection to All Files (*.*), select TestCert_Privileged.pfx or TestCert_Unprivileged.pfx, and then click Open.

  6. On the File to Import page of the wizard, click Next to open the Password page.

    Leave the Passwod box blank. These test certificates do not have a password.

  7. Click Next to open the Certificate Store page. Ensure that Personal is selected in the Certificate store box.

  8. Click Next to display the completion page, and then click Finish.

    The message Import was successful appears.

  9. Click OK to dismiss the message.

    The certificate now appears in the Manage Certificates list. Click Close to return to the Select Certificate dialog box.

  10. Select the certificate you want, and then click OK.

    The certificate is now listed on the property page you started from.

See Also

Tasks

How to: Sign a Visual Basic or Visual C# Application (Devices)

How to: Sign a Visual Basic or Visual C# Assembly (Devices)

How to: Sign the Project Output in a Visual C++ Project (Devices)

How to: Sign a CAB File (Devices)

How to: Install SQL Server Compact 3.5 on a Device

Other Resources

Security in Device Projects