Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can anyone provide a good "idiot's guide" to creating an installer in VS2008 (C#) Pro?

I have Visual C# 2008 Professional and have developed the first half of a C# application (console mode) with the second half in progress now (GUI).

I'm looking for an easy path to creating an installer for it. What are the steps that need to be taken to produce a professional installer?

There's a similar question here regarding the Express edition but I have Pro, and I would like as much as possible to stick with just the standard VS stuff (if you think you can convince me that a third party installer creator is much better than a VS-only solution, give it a shot, by all means).

Keep in mind that I have no interest in upgrading to VS2010 yet, even if it's a hundred times easier to create an installer. That can come later, when the revenue starts rolling in :-)

Also be aware that the GUI component of this application is a totally separate executable from the console part. The console part is a simple "open file 1, do some work on it, write file 2" type and the GUI is a fairly standard "open file, do some stuff" beast so there's no tricky or wildly undocumented behaviour happening.

Basically, I'm looking for (at least) the following:

  • professional looking installer.
  • ability to specify where the application files go.
  • changes to the registry to allow double-clicks on my file extension to open the GUI app with the file as an argument.
  • needs to install everything required (my stuff, .Net if required, and so on).
like image 216
paxdiablo Avatar asked Sep 29 '10 02:09

paxdiablo


2 Answers

This might be a bit more rant than answer but here it goes.

If there is one thing severely broken with Windows client software it is the deployment of applications.

My experience comes from working on NovaMind - Even though I have spent weeks over the years on setup issues, I am by no means an expert in setup technology and I try to focus on our actual product whenever possible. We have used InnoSetup, Visual Studio Setup Project 2008/2010 and finally we have switched to the WiX + Tools approach.

How do you install an application nowadays?

Web Apps: Enter a URL in a browser to get to a web app.

Mac: Drag the downloaded file (same for x64 and x86) to the Applications icon on the Mac. Done.

Windows: Download the right file (user needs to know about x64 and x86 architecture), execute it. Click ‘Next’ a dozen times, wait for the UAC to show, click yes and then hope that the installer did the right thing.

I think that if Windows had a better deployment system, a sane marketplace/app store and a proper live update feature, web apps might never have gotten that popular in the first place. Of course that’s an exaggeration but I believe a lot of damage has been done to the Windows applications ecosystem by not providing a sane, usable deployment model and even now Microsoft seems to pay very little attention to this problem.

How do you update applications nowadays?

Web Apps: No need. It is up to date.

Mac: No inbuilt magic but there is a widely used and powerful solution called Sparkle.

Windows: You better roll your own because there is nothing substantial out there.

ClickOnce should have changed all of this but failed to be usable for real commercial applications.

Here is the rundown:

InnoSetup and other script based installations are simple but cannot produce a .msi file — Some companies require .msi files to automate network deployments. You will also need to have a Windows Installer (.msi) based setup if you want to get the Windows Logo certification.

Visual Studio Setup Project 2008/2010 gives you the basics easily and you can configure a bunch of things but once you want to do the unthinkable like use a high quality icon or include a changing set of files into your setup, you’re screwed. We also had to manually fix the PackageCode and ProductCode every single time we built an update since Visual Studio managed to somehow mess up the assembly versions and would leave an older assembly when updating, thus corrupting the application.

WiX is the de-facto way to create setups on Windows and even the Microsoft Office Setup is supposedly created with WiX. WiX is not simple. There are books available for WiX!

Unfortunately, WiX alone is still not a good solution. We use the dotNetInstaller bootstrapper project to ensure the .NET Framework is installed and to wrap the .msi file and the bootstrapper into a single .exe file that people can download.

With all this you are mostly fine. There are always strange cases were customers don’t have the Windows Installer installed (and thus cannot run the embedded .msi file) or where the .NET Framework installation fails.

Things we haven’t been able to do so far:

  • Localizing our installer!
  • Providing a single download for both x64 and x86 — at the moment we only create a x86 installer because we don’t want our users to think about x64 vs. x86.
  • Have a nice setup UI that also works with high DPI settings. I think this might just be a thing that is not supported in MSI setup.

There is a free product called SharpSetup which seems to address some of these problems and allows you to write a Winforms based UI, but SharpSetup does not come with a bootstrapper and requires the .NET Framework — you can however write your own C++ code to react in this situation.

For live updates we have rolled our own solution and after many issues it is working okay.

You might also want to listen to Scott Hanselman’s podcast episode with Rick Brewster were they talk about the setup and deployment of Paint.NET — While I congratulate Rick and the Paint.NET team on their good setup, the necessity of such a complex solution saddens me.

If you absolutely need to use .msi then I would recommend WiX to anyone who wants to create an installer on Windows, but in the end I am extremely frustrated with the deployment situation on Windows. I have wasted weeks of my time over the years with silly setup issues. With setup you can only lose. You won’t win any happy customers because your setup works but you will lose and frustrate a lot of them if it doesn’t.

like image 96
Patrick Klug Avatar answered Sep 22 '22 14:09

Patrick Klug


Another option is using Inno Setup. It allows you to fully customize installations, where to stick files on the target machine, modify the registry, and all that jazz. If you're willing to spend a bit more time learning a bit about the scripting required to achieve the results you want, it's a very powerful tool. (fulfills all of your requirements and much more) And most importantly, it's free =)

I've been using Inno Setup for all of my larger .NET programs. When the installer runs, it checks to see if .NET is installed and if not, downloads and installs it. As well, I've modified registry and made associations with extensions like you mentioned. Including DLL's with the installer is simple as well - Inno will lump all of the required files into a single executable that takes care of everything.

Additionally, since Inno has been around since 1997, a number of editors have arisen that help make the scripting process a lot easier.

like image 22
AndyPerfect Avatar answered Sep 23 '22 14:09

AndyPerfect