.NET Tips and Tricks

Blog archive

Working with InstallShield

In the November issue of Visual Studio Magazine, I reviewed a pair of Windows installation and deployment packages--Flexera Software InstallShield and Wise Package Studio. Today I'll dive a little deeper in InstallShield.

InstallShield actually provides you with two interfaces for creating deployment packages. One is integrated with Visual Studio. The other is the standalone InstallShield 2011. This interface allows you to choose between a wide variety of project types. These include a number of Wizards (including one for Visual Basic 6) and a ClickOnce deployment project.

However, when the Wizards aren't enough, you'll need to use one of the InstallScript projects. Typically, you'll use an InstallScript project when you want to take control of the installation user interface or when there are tasks that you need to perform after your software package is installed (and, occasionally, before installing your package). While using InstallScript isn't for the faint of heart, InstallShield does go a long way towards managing the process.

For instance, if you select the most "free-form" of the InstallScript projects, the base InstallScriptProject, InstallShield presents the project to you in the Installation Designer, a treeview that organizes the components of the installation package. It's not a Wizard (there's no attempt to walk you through the steps) but the treeview does structure the tasks you need to perform.

The first step, for instance, is to define the "Features" that make up your deployment package. As you add features, a dialog (available from the Feature's property sheet) allows you to create dependencies between features (i.e. don't install this feature without this other feature). Each feature has a set of events associated with it, listed in its Properties Window, that you can tie InstallScript code to.

Further down in the Installation Designer you can write your InstallScript functions that you can tie to your events. The UI isn't as slick as I might like. There's no way to create the skeleton of a function from the Properties Window of a feature as you can when adding event handlers in Visual Studio, for instance. This necessitates some bouncing back and forth in the TreeView between the script node and the features node. But the InstallScript editor is more than just an implementation of Notepad and includes, for instance, IntelliSense-like support.

As I said, InstallScript isn't for the faint of heart (and C programmers will feel more at home with InstallScript than Visual Basic programmers will), but the InstallShield UI goes a long way to managing the complexity.

Posted by Peter Vogel on 11/18/2010

comments powered by Disqus


Subscribe on YouTube