Creating a Strong-Named Assembly

Windows Media Center loads only locally stored assemblies, which reside in the Global Assembly Cache (GAC). For security purposes, the GAC requires that all .NET assemblies, including Windows Media Center applications, have strong names. Therefore, Windows Media Center can only load a Windows Media Center application if it is a strong-named assembly.

The following is the minimum information required to create a strong-named assembly:

  • Assembly title in plain text.
  • Assembly version number.
  • Cryptographic key-pair file used to digitally sign the assembly.

To create a strong-named assembly in Visual Studio 2005

  1. In the Solution Explorer window, select the application.
  2. From the View menu, click Property Pages.
  3. In the Property Pages window, click the Application tab.
  4. Click the Assembly Information button.
  5. In the Assembly Information dialog box, enter a title and assembly version, and optionally enter other values. Click OK.
  6. In the Property Pages window, click the Signing tab.
  7. Select the Sign the assembly check box.
  8. From the Choose a strong name key file drop-down list, do one of the following:
    • Select <New...> to create a new strong name key file.
    • Select <Browse...> to select an existing strong name key file.

The Strong Name tool (sn.exe) included with the Microsoft .NET Framework 2.0 SDK can also be used to create a strong name key file. This tool creates the key with the file name you specify. The following example creates a pair of cryptographic keys with this tool and stores them in a file called KeyPair.snk:

sn -k KeyPair.snk

Note Anyone who has access to the key file can sign assemblies with your identity. After you create the strong name key (.snk) file, store the file in a secure location.

Delayed signing is another option for a Windows Media Center application assembly. Delayed signing reserves space in the assembly for the strong name signature, but defers actual signing until a later stage, typically just before shipping the assembly. This process allows you to closely guard your cryptographic key pair during the development stages of your Windows Media Center application.

For more information, see the following topics on the MSDN Web site:

See Also