Creating a Setup and Deployment Project
In this article I will cover the basics of creating a Windows Installer. This
article will explain the step by step process of creating a Setup Project.
Step 1: Create a Sample .Net Project. I have named this project as
"TestBlogProject".
Figure 1 Sample Project
Create a Setup Project
Open the TestBlogProject in the VS IDE.
Figure 2: Add New Project
Figure 3: Setup Project Dialog
There are five different templates that
are available when you select the project type 'Setup and Deployment Projects'.
1.
Setup
Project:
Creates a Windows Installer project to which files can be
added. This project type is the most generic of the five.
2.
Web Setup
Project:
Creates a Windows Installer web project to which files can be
added.
3.
Merge Module
Project:
Creates a Windows Installer Merge Module project to which
files can be added. This project type is most commonly used for using third
party products.
4.
Setup
Wizard:
Creates a Windows Installer project with the aid of a wizard.
5.
Cab Project:
Creates a Cab project to which files can be added.
For the purpose of this article, I will
be using the template Setup Project. Provide a name for the project as well
choose the location where this project will be established. (See Figure 3) Once
you have done this click 'OK' and you should now see a screen like the
following.
Figure 4: Default Setup Project File
View
Now that we have an empty Setup Project
established.
Let us discuss about the various editors that are available.
1.
Right Click on the
Setup Project and Click View.
Figure 5: File System Editor
1.
Click on the File
System
File System
Editor
The File System (Figure 6) provides you the essential tools to work with the
application folder, user's desktop, and the user's programs menu.
Figure 6: File System Editor
The first thing we want to do here is to
include the relevant files and folders we wish to install on the user's
machine. This is accomplished by right clicking the Application Folder and
selecting 'Add'. The following screenshot is an example of something similar
you may see.
Figure 7: Add Project Output
Now to add project output files to this
folder, Click Project Output.
Click OK.
Merely add one or more of the files that
is vital for your application by clicking on File…. Now that you have you files
in place.
Figure 8: Project Output
We could take additional steps such as
manipulating the user's desktop with items such as a shortcut, as well you can
add a program group to the user's program group.
Create
Shortcut
Name the shortcut as you want. I have given the name as TestBlog. Drag and drop
to User's Desktop Folder
Figure 9: Desktop Shortcut to
application
The next item you find of immense
importance is the User Interface Editor. Inside of this editor you may
eliminate or include dialogs that are needed for this install project. The
following screenshot is the default User Interface that is created when I initially
created this setup project (See Figure 10). The only variation is that I have
added a Customer Information dialog.
Figure 10: User Interface Editor
To include the Customer Information
dialog that I spoke of follow the following steps.
1.
Under Install right click on the 'Start'
node
2.
Choose 'Add Dialog'
Figure 11: Customer Information
1.
Select the Customer Information Dialog
and click 'OK'
As you can see there are is an ample
variety of dialogs you can choose from.
Prerequisites Installation in Windows
Installer
Most applications have prerequisites:
Components such as the .NET Framework runtime must be available on a target
computer in order for the application to run. The deployment tools in Visual
Studio include the capability to automatically detect the existence of
components during installation and install a predetermined set of prerequisites
— a process known asbootstrapping.
This will be achieved as follows:
To choose
which prerequisites to install
1.
In
Solution Explorer,
select the deployment project and Right Click
2.
Click
Properties.
3.
In the
Property Pages dialog
box, expand the Configuration
Properties node, and then
select theBuildproperty
page.
4.
Click the
Prerequisites button.
5.
In the
Prerequisites dialog
box, make sure that the Create
setup program to install prerequisite components box
is checked.
6.
In the
Choose which prerequisites to
install list, check the prerequisites that
you wish to install, and then click OK.
To specify the
download location for prerequisites
·
In
Solution Explorer,
select the deployment project, right click.
·
Click
Properties.
·
In
the
Property
Pages dialog box, expand the Configuration Properties node,
and then select theBuildproperty
page.
·
Click
the
Prerequisites button.
·
In
the
Prerequisites dialog
box, choose a location:
o
If you want to deploy the installers for
the prerequisites to a vendor, click
Download
prerequisites from the component vendor's web site.
o
If you want to deploy the installers for
the prerequisites to the same location as your application installer, click
Download prerequisites from the
same location as my application.
o
If you want to deploy the installers for
the prerequisites to a different location, click
Download prerequisites from the
following location and enter a
local path, URL, or file-share location.
·
Click
OK to
continue.