CHAPTER 14 BUILDING AND CONFIGURING CLASS LIBRARIES
Figure 14-16. A strongly named assembly records the public key in the manifest
Great! At this point, we could deploy our shared CarLibrary.dll assembly to the GAC. However,
remember that these days, .NET developers can use Visual Studio to create strongly named assemblies
using a friendly user interface rather than the cryptic sn.exe command-line tool. Before seeing how to
do so, be sure you delete (or comment out) the following line of code from your AssemblyInfo.cs file
(assuming you manually added this line during this section of the text):
// [assembly: AssemblyKeyFile(@"C:\MyTestKeyPair\MyTestKeyPair.snk")]
Generating Strong Names Using Visual Studio
Visual Studio allows you to specify the location of an existing *.snk file using the project’s Properties
page, as well as generate a new *.snk file. To do so for the CarLibrary project, first double-click the
Properties icon of the Solution Explorer, and select the Signing tab. Next, select the “Sign the assembly”
check box, and choose the option from the drop-down list (see Figure 14-17).
537