Game Development Reference
features to support complex installations. Installers can read and write keys with-
in the Windows registry, including an automated mechanism to register both
COM components and .NET components (within the Global Assembly Cache).
Launch conditions can be used to ensure that all requirements are satisfied before
installation can continue. Launch conditions can check information like the user
and computer name, operating system, presence of the .NET Common Language
Runtime, and if a registry entry or another application exists. Installers can also
prompt the user for different pieces of information, allowing for a customizable
installation process. Custom setup programs or scripts can also be initiated when
the installation completes successfully.
A third deployment approach, covered in Chapter 44, “Deployment and Versioning with ClickOnce,”
describes a new technology introduced by Microsoft in .NET 2.0. I recommend that you read this
chapter if you are concerned about automatic updates, smart client installation, and isolation under
a least privilege account. For robust installations, I recommend that you stick with Windows Installer.
This chapter will cover how to create and configure a Visual Studio Installer, along
with showing how to develop custom installer actions for any fancy tasks your
application needs to perform during installation.
Creating a Setup Project
Visual Studio 2005 provides five types of project templates that can be used to
handle the setup and deployment of .NET applications. These templates are avail-
able from the same New Project menu that you create new applications from.
Figure 46.1 shows the New Project dialog for the deployment project templates.
The Setup Project template is used to create a Windows Installer for your applica-
tions. This is the project type that will be covered in this chapter.
The Web Setup Project template is used to create a Windows Installer that can
install a web application to a virtual directory on a web server.
The Merge Module Project template is used to package shared files and compo-
nents into a module that can be shared between multiple setup projects. Merge
modules are only installed during an installation if the files in the merge module
have not yet been installed on the target machine.
The Setup Wizard template is a wizard that helps guide you through the creation
of one of the project templates.