Create Installer for .NET Windows Applications

This post speaks about creating a installer for .NET windows applications using Visual Studio 2005. Note, this is different from creating a Setup Project for Web Applications.

For any desktop application with a good number of files, an installer with all your files bundled up is required for a hassle free usage. A handful of applications appear on googling, most of the better one’s, unfortunately, being shareware’s. Microsoft Visual Studio 2005 provides a pretty impressive utility for this purpose. This post leads you from creating a installer project, building the setup & MSI files, combining these two files, a rusty way to launch application after installation, and keeping your application updated

There are various tutorials on the net to guide you on creating a installation package.
Here is a good link,
http://en.csharp-online.net/Deploying_Windows_Applications

This post continues from where the above post concludes.
While the above article serves as an excellent guide on deploying your .NET application using the ClickOnce deployment as well as Visual Studio deployment, this post goes on to show further ways for tweaking your installation.

Combining generated files
Your .NET Application installer, as delivered by your Visual Studio Setup Project consists of 2 files, Setup.exe and .msi. While the Microsoft Installer (MSI) file is sufficient for installation on most machines, Setup.exe does a bit of error handling in case an incompatible .NET framework is installed. Installing the application with Setup.exe, almost guarantees a clean install. While retaining this advantage, it could be cumbersome to put up two files for installing.

A solution could be create an extrator which consists of these two files. A better solution would be to have a single executable, that comprises these two files.
I use a free file compression utility, Zip Genius, to achieve this. Create a ZIP archive of the two files generated from the setup project, right click on the archive file and you see a ‘Convert to exe’ option. Fill in the details, and Voila, you have a single executable, which consists of both files required for your installation, Custom Icon, Signature, Et Al.

Launching application after install
With tons of installers out there, and with people getting used to the way these installers behave, not launching your application once installation completes could raise the user’s eyebrows. You wouldn’t want one to start digging his desktop for your icon once the installation is complete, Would you?

Though Visual Studio Setup doesn’t provide this feature (I am looking at VS 2005), we could use a small workaround for achieving this.
Visual Studio Setup project does provide ‘Custom Actions’ on Install, Commit, RollBack and Uninstall. But these events are futile when it comes to launching the application itself.

Auto updates for your application
OK, now you are done with the Visual Studio Setup Project, Combining the generated files and making sure it launches after the installation. Now how about making sure the user keeps the installed application up-to-date?

I achieve this by having an XML file hosted that indicates the current version, latest updates, and the link to download the latest version. Your application could periodically check this XML file for newer versions.



5 Responses to “Create Installer for .NET Windows Applications”

  1. Markanoslicx

    I only wanted to tell you thank you! for all the great info found on your blog, even helped me with my job recently 🙂 keep it up!

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>