views:

145

answers:

5

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).
A: 

Visual Studio 2008 has built-in setup/installer support.

Add a new project to your solution, and select the 'Setup Project' option from the 'Other project types > Setup and Deployment' category.

Have a look at Windows Installer Deployment overview, and a step-by-step walkthrough

Joviee
It's really, really bad. I've used VS setup projects and they have several issues which made me switch to InnoSetup which worked perfect for me. Sorry that I can't remember the exact issues right now though.
gaearon
From your comment on the original question ("it always tried to put files in some mysterious Common Files subdirectory with a crazy name"), I can't help but wonder if you are thinking of ClickOnce? While the VS setup projects aren't as customisable as, say, a WiX installer, it is a bit rough to call it "really, really bad". You get enough control to do everything that the question required, and its nice and friendly for someone new to installation/deployment :)
Joviee
By biggest problem with the VS Installer projects is that you can't run them from MSBuild - if you want to build them on a build machine, that machine has to have a full VS install, and you have to ask VS, very nicely, if it would mind building the setup project for you.
Damien_The_Unbeliever
+5  A: 

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.

AndyPerfect
Upvote for Inno, it worked excellent for my project after I was having issues with VS setup project.
gaearon
+7  A: 

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 if Windows would have 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 useable 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.

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 are screwed. We also had to manually fix the PackageCode and ProductCode every single time we build 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 Framwork 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 were 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.

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.

As it stands 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.

Patrick Klug
It may well be more rant than answer but I can take the rant since the answer bit is still useful :-)
paxdiablo
:) I really really wish there would be a better way that 'just works'...
Patrick Klug
+1 for a constructive rant
AndyPerfect
A: 

I use Advanced Installer, it is dead simply, and I use it, because of the limitations of VS.

http://www.advancedinstaller.com/

The "downside" is that for fully automatic installation of dependencies you have to pay ;-)

macias
A: 

If you know scripting languages you can check out NSIS as an alternative to VS. There's enough documentation that you can copy paste their example installer and replace their file locations with your own.

WanderingThoughts