How to Create an Installer For a WinForm Application Using Setup Project

In this article, I will explain the process of creating an installer for a Windows Forms application using Setup Project.

Introduction

In this article, we will create a Setup Project to build an installer of a Windows Application. We will create a setup for the Windows Application created in my last article.

Step 1

Create a Setup Project as below and give it a name:

WinIns1.gif

Step 2

Add the Windows Forms Application project for which you want to create the installer. I will add the application created in my last article.

Choose: File -> Add -> Existing Project and select your project

Step 3

Now the File System editor is opened for you. If not then Choose View -> Editor -> File System.

Now, you need to add output of your Windows Form Application to build the setup. Right-click on the Application Folder and select Add -> Project Output.

WinIns2.gif

Leave the default selection of Primary Output in the "Add Project Output Group" dialog box and click the OK button. This will add the primary output of your setup with the name "Primary output from MultiThreading_BackgroundWorker (Active)" on the right pane of the File System editor.

Step 4

Right-click on the Primary output and select the first option to create a shortcut on the target machine.

WinIns3.gif

Rename this shortcut to "My App". Repeat this process to create one more shortcut, one for the Desktop and one for the Programs Menu of the target machine. Drag one shortcut in the "User's Desktop" folder and one in the "User's Programs Menu" folder on the left pane of the File System editor.

You can display an icon for the shortcuts by specifying their Icon property.

Step 5

Select Setup Project in the Solution Explorer and press F4 to view its properties. You should change the following properties:

Author Give your name as you are the author
Manufacture Application on the target machine will be installed under this value in the Program Files
RemovePreviousVersions Change it to True if you want to remove previous version of this application installed on the target machine
Version Give a version to your installer

Step 6

Now we are ready to build our project. Just build the project and the installers are ready in the debug folder of the Setup Project. There are two files; one is Setup.exe and the other is ProjectName.msi. Copy both files on the target machine and run any of the two to install the Windows Application on the target machine.

Note: As we have developed our application in .Net Framework 3.5, this framework needs to be installed on the target machine.

Step 7

Run the installer on the target machine:

WinIns4.gif


Similar Articles