In this article I will explain the process of creating an installer for a Windows Forms application using Setup Project.
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.
Create a Setup Project as below and give it a name:
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
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.
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.
Right-click on the Primary output and select the first option to create a shortcut on the target machine.
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.
Select Setup Project in the Solution Explorer and press F4 to view its properties. You should change the following properties:
Give your name as you are the author
Application on the target machine will be installed under this value in the Program Files
Change it to True if you want to remove previous version of this application installed on the target machine
Give a version to your installer
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.
Run the installer on the target machine: