Creating a distribution package (.msi) for you Visual Studio projectSo you created a nice application in C# and want to share it with the world.
One way to do it is by creating a distribution package. By doing so Microsoft helps you by adding a few features to your setup process. I'll show you a few in the step by step.
First add a new installer project to your solution.
I choose Visual Studio Installer -> Setup Wizard which can be found in Setup and Deployment category
|Visual Studio Installer|
Follow the wizard, its fairly simple.
Choose the project type you wish to create.
Choose the project output you wish to use.
I usually select "Primary output from <Project>" as in the sample image below.
The next page allows you to select files to add to the distribution.
The files can be a readme file, nfo file, images or whatever else you want to add.
At this point your done creating the simple package.
Adding Prerequisites to InstallerSometimes, your project requires prerequisites to run correctly. The most common prerequisite is the .Net Framework itself. The Visual Studio Installer allows you to add the prerequisites with your distribution thus helping the user install the application correctly and your program run smother.
To add prerequisites, go to the setup project and open the properties.
Notice the Prerequisites button on the lower right.
After clicking the button, we can add the relevant items.
In my case I choose the .NET Framework 4 Client Profile so in the case that the user didn't download in advance, the .NET Framework, the Installation will help the user do so.
Notice that you can choose from where you want the component to be installed.
Either download from the vendors website (usually Microsoft) or from the location of the application. The same location means that the prerequisite will be bundled with your program making the install file larger.
I've never found much use for the third option.
Creating a shortcut to the applicationOne of the most important things an installer needs to do is add a shortcut to start up the application, we wouldn't want the user looking for the application all over the filesystem :-)
Go to the Install Projects' File System Editor. You can find it by selecting the Installer project from the solution explorer and notice the new icons at the top of the solution explorer. The file system editor is the second from the left.
Select the Application Folder
You should see the "Primary Output ..." in the window beside it.
Right click on the "Primary Output ..." and select the "Create Shortcut" option.
Now you can drag the new shortcut to the User's Desktop or the User's Program Menu.
I usually rename the shortcut as well.
The Installer has loads more features, if you find any good ones, leave a comment.