I’m working on an installation and configuration application in C# for a project I’m working on, and I’m wondering what the best method of internally organising everything is.
Requirements:
- Single executable for deployment, no other files bundled with it.
- Has to support custom config steps on each panel, which contribute to a generated XML config file at the end.
- Certain steps may be skipped based on certain choices made within the installer flow.
- Must support dynamic config screens based on information fed back from classes in one of my libraries.
Here’s a description of my prototype:
- A large form with a bunch of Panel controls, each representing one “screen” of the wizard. Each is named appropriately.
- A class for each “screen”, deriving from a base type I defined. I call specific methods of it (e.g.
Enter,Back,Forward) when certain events occur. - State is stored as a
Dictionary<string,object>, which is passed to each screen. The final screen (the actual “Installing…” screen) reads config out of this and dumps it into the XML file. - Each screen’s code is responsible for handling the “Next” and “Prev” buttons, so I can control where it jumps to based on settings in the current screen.
- A number of modules are stored in my library which provide information about extra config steps that need to be taken. I’m implementing this through reflection and automated UI generation.
- Assets are stored in the resources of the executable.
I don’t want to use a generic installer package (e.g. InstallShield) because the logic is totally custom and calls upon one of my class libraries. What I would like to know is – am I setting this out in a really circuitous way? Is there a simpler or more standard way to wizard-style applications?
Here’s the short answer:
A commercial tool is perfect for what you need because it supports both custom installation UI and dynamic XML files. Anything else requires a lot of learning and hard work.
And the long explanation:
A custom installation UI is not an easy task. Windows Installer offers built-in dialogs and controls, so it’s usually the best solution. You could also try a proprietary installation engine, but you will need to learn it.
You’re also taking an incorrect approach by trying to control everything with custom code and classes. Most setup authoring tools offer direct support for handling the installation UI and XML files. Why try reinventing the wheel?
So you basically need to find the setup authoring tool which is best for you. Here is a general list:
http://en.wikipedia.org/wiki/List_of_installation_software
The tools are either MSI-based or proprietary. Personally I prefer Windows Installer (MSI packages).
Trying to implement all your tasks with custom code is just not worth it.