views:

87

answers:

5

hi,

I was just wondering why do we need installer programs to create setups? We can create a desktop application which will do registry changes, registration of assembly, creation of config files and all.

Why dedicated installers are there? Do they serve any other purpose or task that a desktop application cannot do?

+2  A: 

Overview of the Windows Installer Technology

You would have to take into consideration a huge amount of factors if you wrote your own for a enterprise environment.

abmv
A: 

One reason is that certain actions might need Admin rights on the machine, and so it's easier and safer to just have to request Admin rights to the installer than for the application it self.

Another is that if you want to install a database or similar do other complicated setup that's only needed one time, why pollute your application's code base with code that it only uses that first time, easier to keep it separate.

ho1
A: 

You could accomplish everything required to install an application by writing your own executable. But why? The installers you can create in Visual Studio are pretty flexible with regards to writing your own custom operations but they also ensure that everything is covered with installing the application on Windows. It also provides rollback and uninstall mechanisms.

By writing your own, unless there's a specific reason to, you'd be using a sledgehammer to crack a nut; you might also miss things. I always feel more comfortable installing software using an MSI.

David Neale
A: 

For me, its about separation of concerns. Your application already has a vast amount of functionality that it is build for, why make it that extra bit more complicated by cramming in installation logic. It is just so much cleaner, and IMO better practice, to create a separate installer application to take care of that end of things.

James
+3  A: 

In principle you could roll your own installer, especially if your app is manually downloaded by users. However, you will be missing some benefits that installers typically offer:

  1. Automated removal - all changes added during install can be automatically undone during uninstall

  2. elevated privileges - some installation systems can run with elevated privileges, and can perform administrative tasks at installation time that the user installing the software would not ordinarily be able to perform

  3. Re-installation - if any of your programs files become deleted or corrupted, the installer can reinstall these.

  4. Silent install - installation of the product without a user interface, and sometimes without the user initiating the install (e.g. happens as part of machine startup or user login.)

  5. Rollout, group configuration: for large deployments, installation packages can be deployed to many users at once and upgrades can be managed.

  6. Packaging - often typically package all files in a single package, usually compressed that is then uncompressed at installation time. The package may also be digitally signed for authentication.

You could provide some or all of this in your app, but you'd be re-engineering a lot of code that is available for free already. See for example, AdvancedInstaller, which produces MSI files for windows (free edition available.)

Alternatively, there is the WiX toolset for producing MSIs from an XML desciption.

mdma