Theocharis K.
Theocharis K.

Reputation: 1341

How do you "wrap" your application in an installer?

To start with this is maybe a vague question and it might not have a well-structured answer, so it may not comply with SO rules.

So far I have written several rather small applications but all of them consisted of an executable file that would run "as is". This means that the actual application didn't require any installation to use beforehand, you could simply download the file online, run it and you are set to go.

Most of the applications online require you to download an installer. Then you set some preferences (namely where you want to place the files of the application, who is the main user etc) and when you are done the installation starts unzipping(?) the files required to actually run the application.

I suppose that the installer is a wrapper that includes your code and/or any other resources you may be utilizing. Can anyone guide me to some relevant info about this process? I do not have a relative problem, maybe it's not clear what I am asking, I am just curious as how things work.

Upvotes: 3

Views: 1111

Answers (2)

selbie
selbie

Reputation: 104514

The standard Windows Installer experience is accomplished by creating a setup package known as an MSI file. An MSI, upon being launched by the user, installs components (files, registry keys, runtime components, other setup package, etc...). The MSI install experience can be configured to have a UI. The usual approach being the stock "wizard" UI that the user can click "next" through as he chooses the setup options (e.g. install location). The nice thing about MSIs is that they automatically come with an "uninstaller" that shows up in Control Panel's Add/Remove Programs dialog. If the user cancels the setup (or something fails to install), it performs automatic rollback.

Visual Studio usually includes a set of project types called "Setup package" which gives you support for creating rudimentary installer wrappers. This will likely meet your needs if all you are installing are a handful of files.

I recommend using the WIX Toolset, which is an open source project sponsored by Microsoft, to build setup packages. WIX gives you a lot more control over the entire setup process. There's some learning overhead with it, but you'll find this to be the most flexible.

One other quick point. Rarely do Windows EXEs run "as is". Whether it be a .NET EXE or an app built with C/C++, there's usually a dependency on a runtime such as a particular version of .NET or the Visual Studio CRT. Typically, when you develop such EXEs, they do indeed run as is on your own computer. That because Visual Studio installed all those dependencies for you. Copy that same executable to another computer running an older version of Windows and you might find it doesn't run. You'll want to come up to speed on understanding how to embed .NET versioning and embedding the CRT with respect to your setup package.

Upvotes: 1

Related Questions