Look, No Hands: InstallShield’s Automation Tools

The InstallShield environment’s assistants, Installation Designer, and wizards make up a graphical front end for authoring your installation project, where you define your product name and version, your feature–component–data hierarchy, and release information. These graphical tools enable you to quickly prototype, organize, build, validate, and test your installation.

When the shape of your installation project is complete, you’ll usually want to incorporate installation project changes and builds into a larger automated process. The general tools InstallShield provides for automated building and modification of your projects include ISCmdBld.exe and the InstallShield automation interface, which work with both Windows Installer (MSI) and InstallScript projects, saved in either binary or XML format. These tools are available locally with your InstallShield installation, and starting with InstallShield 2011 extra Standalone Build licenses are available for purchase.

ISCmdBld.exe: The command-line release builder. In the simplest form, point to your project file with the -p switch, specifying the release name (for any project type) and configuration name (for an MSI project type) that you want to rebuild.

    IsCmdBld -p "C:InstallShield ProjectsSampleApp3000.ism" -r "dvd" -a "V100"

This command rebuilds the specified release with its settings as you defined them in the Release Wizard or Releases view. As the release builder runs, it displays status, warning, and error messages, and finally sets the ERRORLEVEL environment variable to 0 for a successful build or to 1 for a failed build.

Further options exist for overriding the build output location, source-path variable values, or the product version; for setting release flags or MSI property values; for building patch configurations; and for running or skipping script compilation or validation tools. Run ISCmdBld with no arguments or the -? switch for brief usage information, and see the help topic “ISCmdBld.exe” for details about the other options available.

InstallShield Automation: The InstallShield automation interface provides programmatic access to most areas of functionality exposed in the InstallShield environment. InstallShield automation exposes a COM interface that can be called by many languages to edit or build an installation project.

The top-level automation object is the ISWiProject object, and VBScript code that opens, modifies, and saves a project begins and ends like this:

    set oISM = CreateObject("ISWiAuto17.ISWiProject")

    oISM.OpenProject "C:InstallShield ProjectsSampleApp3000.ism"

    '     perform changes here

    oISM.SaveProject : oISM.CloseProject : set oISM = Nothing

(Note that the InstallShield automation interface is versioned: see your InstallShield help library for the specific ISWiAuto version number you’ll pass into the call to CreateObject.)

For example, changing your project version would involve code similar to the following:

    set oISM = CreateObject("ISWiAuto17.ISWiProject")

    oISM.OpenProject "C:InstallShield ProjectsSampleApp3000.ism"

    oISM.ProductVersion = "1.2.3"

    oISM.SaveProject : oISM.CloseProject : set oISM = Nothing

By extending this technique, you can (for instance) read your project’s existing version and increment the last field, or read your main executable’s version number and set your project’s version to match the first three fields of that version.

Other objects in the InstallShield automation interface expose settings for your project’s features, components, shortcuts, conditions, releases, properties, and more; the “Automation Interface” section of the InstallShield reference lists the different objects that are available and provides many samples. The InstallShield Tips & Tricks archive and the InstallShield Community contain many more examples of performing specific tasks using InstallShield automation.

Beyond these general tools, InstallShield provides additional specialized tools, such as integration with Microsoft Visual Studio and Microsoft Team Foundation Server, and with version control systems. For more information, see the InstallShield Web site and the InstallShield help library.

Leave a Reply

Your email address will not be published. Required fields are marked *