Setup Programs
One of the ways to deploy your application is by creating a Setup Program.
This is a special project in Visual Studio.NET that will package your
application into an installer executable. A user can run the executable to
install the application on their machine. Using the Control Panel's
Add/Remove Programs option, the user can later uninstall the application.
Creating a Setup Project
Launch Visual Studio.NET and open the project that you want to deploy. Select
AddProject->New Project... from the File menu. Click on the item "Setup and
Deployment Projects" under Project Types. There are several types of setup
projects, as seen below:
| Project Type |
Description |
| Setup Project |
Creates an Installer for a windows application |
| Web Setup Project |
Creates an Installer for a web application |
| Merge Module Project |
Packages components that might be shared by multiple applications. |
| Setup Wizard |
Creates an Installer for either a windows or web application using a Wizard |
| Cab Project |
Creates an Installer that packages files into a cab file for downloading via a
browser |
For our example Windows application, we'll use the Setup Wizard. We indicate
that we want to create a setup for a Windows application, and then indicate
that we want the primary output from our project (in our example, WinApp316).
We choose not to install any additional files, and then are presented with a
summary of our choices. Clicking the Finish button starts the setup project
creation. When Visual Studio.NET is done, you'll see the screen below. Here you
can add files in special folders representing the Application Folder (eg. for a
readme.txt), the User's Desktop (eg. for a shortcut), and the User's Program
Menu (eg. for a programs group).
Next you can set the properties of the setup project by going to the Properties tab in Visual Studio.NET for the project. Here you can indicate your company name, application name, description, support url, and more.
At this point, you can build your application. Right click the Setup Project
and select Build. By default, a setup project is not included in a
solution-wide build. In the build output pane, you should see messages like the
following:
------ Starting pre-build validation for project 'SetupWizard1' ------
------ Pre-build validation for project 'SetupWizard1' completed ------
------ Build started: Project: SetupWizard1, Configuration: Debug ------
Building file 'E:\TestProjects\SetupWizard1\Debug\SetupWizard1.msi'...
WARNING: This setup does not contain the .NET Framework which must be installed
on the target machine by running dotnetfx.exe before this setup will install.
You can find dotnetfx.exe on the Visual Studio .NET 'Windows Components Update'
media. Dotnetfx.exe can be redistributed with your setup.
Packaging file 'WinApp316.exe'...
Packaging file 'InstMsiW.Exe'...
Packaging file 'InstMsiA.Exe'...
Packaging file 'Setup.Exe'...
If you now open the directory where you placed the setup project, and navigate
into the release directory, you'll find the setup files necessary to install
your web application.
If you double click setup.exe, you will start the installer wizard. After installing,
if you open up the Add/Remove Programs dialog from the Control Panel, you will
see the application listed. From here, you can uninstall the application.
Setup Customization

If you right click the Setup Project, and select View, or use the toolbar at the top of the Solution Explorer, you'll see that there are several other views where
you can indicate files to install (as we've seen), the setup interface, registry entires, new file types, launch conditions, and custom actions. Here are some screenshots
from each section. We suggest you create a setup project of your own, and familiarize yourself with the different customizations you can make.