Windows Installer

This article is about the Microsoft Windows component. For the installation of the operating system itself, see Windows Setup.
Windows Installer

Help screen of Windows Installer 5.0 running on Windows 7
Developer(s) Microsoft
Initial release 31 August 1999 (1999-08-31)
Stable release
5.0 / 22 July 2009 (2009-07-22)[1]
Operating system Microsoft Windows 2000 and later
Platform IA-32, x86-64, Itanium
Type Installer
License Freeware
Windows Installer Package[2]
Filename extension .msi, .msp
Internet media type application/x-ole-storage, text/mspg-legacyinfo
Developed by Microsoft
Type of format Archive
Container for Installation information and an optional .cab or .7z file payload
Extended from COM Structured Storage
Open format? No

Windows Installer (previously known as Microsoft Installer[3]) is a software component and application programming interface (API) of Microsoft Windows used for the installation, maintenance, and removal of software. The installation information, and optionally the files themselves, are packaged in installation packages, loosely relational databases structured as COM Structured Storages and commonly known as "MSI files", from their default filename extensions. Windows Installer contains significant changes from its predecessor, Setup API. New features include a GUI framework and automatic generation of the uninstallation sequence. Windows Installer is positioned as an alternative to stand-alone executable installer frameworks such as older versions of InstallShield and NSIS.

Before the introduction of Windows Store, Microsoft encouraged third parties to use Windows Installer as the basis for installation frameworks, so that they synchronize correctly with other installers and keep the internal database of installed products consistent. Important features such as rollback and versioning depend on a consistent internal database for reliable operation. Furthermore, Windows Installer facilitates the principle of least privilege by performing software installations by proxy for unprivileged users.

Logical structure of packages

A package describes the installation of one or more full products and is universally identified by a GUID. A product is made up of components, grouped into features. Windows Installer does not handle dependencies between products.

Products

A single, installed, working program (or set of programs) is a product. A product is identified by a unique GUID (the ProductCode property) providing an authoritative identity throughout the world. The GUID, in combination with the version number (ProductVersion property), allows for release management of the product's files and registry keys.

A package includes the package logic and other metadata that relates to how the package executes when running. For example, changing an EXE file in the product may require the ProductCode or ProductVersion to be changed for the release management. However, merely changing or adding a launch condition (with the product remaining exactly the same as the previous version) would still require the PackageCode to change for release management of the MSI file itself.

Features

A feature is a hierarchical group of components. A feature may contain any number of components and other sub-features. Many packages only involve one feature. More complex installers may display a "custom setup" dialog box, from which the user can select which features to install or remove.

The package author defines the product features. A word processor, for example, might place the program's core file into one feature, and the program's help files, optional spelling checker and stationery modules into additional features.

Components

A component is the basic unit of a product. Each component is treated by Windows Installer as a unit. The installer cannot install just part of a component.[4] Components can contain program files, folders, COM components, registry keys, and shortcuts. The user does not directly interact with components.

Components are identified globally by GUIDs; thus the same component can be shared among several features of the same package or multiple packages, ideally through the use of Merge Modules.

Key paths

A key path is a specific file, registry key, or ODBC data source that the package author specifies as critical for a given component. Because a file is the most common type of key path, the term key file is commonly used. A component can contain at most one key path; if a component has no explicit key path, the component's destination folder is taken to be the key path. When an MSI-based program is launched, Windows Installer checks the existence of key paths. If there is a mismatch between the current system state and the value specified in the MSI package (e.g., a key file is missing), the related feature is re-installed. This process is known as self-healing or self-repair. No two components should use the same key path.

Setup phases

User interface

The user interface phase typically queries the target system, displays an installation wizard and enables the user to change various options that will affect the installation.

However, the user interface sequence should not make any changes to the system, for the following reasons:

  1. A user may install or uninstall an MSI package in passive mode or silent mode, bypassing this phase entirely. (Passive mode bypasses the user interface phase but shows a graphical progress bar. Silent mode shows nothing.) During installation, information gathered in this phase may be supplied beforehand through the command-line interface.
  2. The user interface sequence runs with user privileges, and not with the elevated privileges required during installation.

Execute

When the user clicks the "Install" button in a typical MSI installation wizard, installation proceeds to the Execute phase, in which software components are actually installed. The Execute phase makes system changes, but it does not display any user interface elements.

The Execute phase happens in two steps:

Rollback

All installation operations are transactional.[5] In other words, for each operation that Windows Installer performs, it generates an equivalent undo operation that would revert the change made to the system. In case any script action fails during deferred execution, or the operation is cancelled by the user, all the actions performed until that point are rolled back, restoring the system to its original state. Standard Windows Installer actions automatically write information into a rollback script; package authors who create custom actions that change the target system should also create corresponding rollback actions (as well as uninstall actions and uninstallation-rollback actions). As a design feature, if applied correctly this mechanism will also rollback a failed uninstall of an application to a good working state.

Other features

Windows Installer can advertise a product rather than actually installing it.[6] The product will appear installed to the user, but it will not actually be installed until it is run for the first time by triggering an entry point (by means of a Start menu shortcut, by opening a document that the product is configured to handle, or by invoking an advertised COM class). A package can be advertised by an administrator using Group Policy or other deployment mechanism, or by running the msiexec executable with the /jm (for per-machine advertisement) or /ju (for per-user advertisement) switch. Some MSI packages authored in Installshield may prevent the use of these and other Native MSI features.

The user must have administrator privileges to complete the advertised installation.

Installation on demand

Similar to some advertisements, it consists in the installation of features as soon as the user tries to use them.[7]

Administrative installation

An administrative installation creates an uncompressed source image for a product, typically to be used for installing or running an application from a network location.[8] An administrative installation is not a typical installation, in that it does not create any shortcuts, register COM servers, create an Add or Remove Programs entry, and so on. Often an administrative installation enables a user to install the product in such a way that its features run from the uncompressed installation source.

Administrative installations are also useful when creating a Windows Installer patch, which requires uncompressed images of the earlier and current versions of a product in order to compute binary file differences. An administrative installation is performed by running the msiexec executable with the /a switch.

Custom actions

The developer of an installer package may write code to serve their own purpose, delivered as a DLL, EXE, VBScript or JavaScript. This can be executed during the installation sequences, including when the user clicks a button in the user interface, or during the InstallExecuteSequence. Custom Actions typically validate product license keys, or initialize more complex services. Developers should normally provide inverse custom actions for use during uninstall.

Msiexec provides a way to break after loading a specified custom action DLL but before invoking the action.[9]

Merge modules and nested executables

A Windows Installer package may contain another package to be installed at the same time. These are ideally provided as a .msm file component, but may also be a separate executable program which will be unpacked from the installer package during the InstallExecuteSequence and can be run immediately. The file can then optionally be deleted before the end of the InstallExecuteSequence, and so is ideal for using with older installers.

Miscellaneous

Windows Installer allows applications to run directly from a network share, without the need for a local copy (run from source); it can repair broken installations by restoring damaged or deleted files, registry entries and application shortcuts; it supports per-user installation of applications; it can resolve component identifiers into paths, allowing applications to avoid hard-coded file paths; and it natively supports patches (.msp files made out of patch creation properties) and other customizations of packages through manipulations (transforms or .mst files) of a package's relational database. Version 2.0 onwards, it supports digital signatures and version 3.0 onwards, delta compression for patches.

It is also unique among installation software frameworks for Windows in that it is highly transparent. The full API and all command-line options are documented; packages are freely viewable and editable, both with free tools and programmatically (as opposed to the proprietary and even weakly encrypted packages of InstallShield); and the format for file archives is the well documented cabinet file format.

File extraction only

Individual files can be extracted from a .MSI file without carrying out a full installation, either by using the Installer with an appropriate command line[10][11] or by certain third-party software such as 7-Zip. NOTE: Not all files can be extracted using these methods such as different version of a file getting installed based on option will fail to be properly extracted.

Interoperability with Windows features

Windows Installer 4.0, which was shipped with Windows Vista, incorporates capabilities to take advantage of User Account Control architecture that also was introduced starting with Vista. MSI packages can be marked when not requiring elevated privileges to install, thus allowing a package to install without prompting the user for Administrator credentials (provided that the installation does not write to any areas that a regular user does not have access to, including Program Files). Windows Installer also works in conjunction with the Restart Manager; when installing or updating an application or system component with "full" user interface mode, the user will be displayed a list of affected applications that can be shut down, and then restarted after files have been updated. Installer actions running in silent mode perform these application restarts automatically. System services and tray applications can also be restarted in this manner.

Developing installer packages

Creating an installer package for a new application is not trivial. It is necessary to specify which files must be installed, to where and with what registry keys. Any non-standard operations can be done using Custom Actions, which are typically developed in DLLs. There are a number of commercial and freeware products to assist in creating MSI packages, including Visual Studio (up to VS 2010[12]), InstallShield and WiX. To varying degrees, the user interface and behavior may be configured for use in less common situations such as unattended installation. Once prepared, an installer package is "compiled" by reading the instructions and files from the developer's local machine, and creating the .msi file.

The user interface (dialog boxes) presented at the start of installation can be changed or configured by the setup engineer developing a new installer. There is a limited language of buttons, text fields and labels which can be arranged in a sequence of dialogue boxes. An installer package should be capable of running without any UI, for what is called "unattended installation".

ICE validation

Microsoft provides a set of Internal Consistency Evaluators (ICE), that can be used to detect potential problems with an MSI database.[13] The ICE rules are combined into CUB files, which are stripped-down MSI files containing custom actions that test the target MSI database's contents for validation warnings and errors. ICE validation can be performed with the Platform SDK tools Orca and msival2, or with validation tools that ship with the various authoring environments.

For example, some of the ICE rules are:

Addressing ICE validation warnings and errors is an important step in the release process.

Versions

Version Included with[1] Also available for
1.0 Office 2000 N/A
1.1 Windows 2000 RTM, SP1, SP2 Windows 95, Windows 98
Windows NT 4.0
1.2 Windows Me N/A
2.0 Windows XP RTM, SP1
Windows 2000 SP3, SP4
Windows Server 2003 RTM
Windows 9x
Windows NT 4.0
Windows 2000
3.0 Windows XP SP2 Windows 2000
Windows XP
Windows Server 2003
3.1 Windows XP SP3
Windows Server 2003 SP1, SP2
Windows XP Professional x64 Edition
Windows 2000
Windows XP
Windows Server 2003
4.0 Windows Vista RTM, SP1
Windows Server 2008 RTM
N/A
4.5[14] Windows Vista SP2
Windows Server 2008 SP2
Windows XP
Windows Server 2003
Windows XP Professional x64 Edition
Windows Vista
Windows Server 2008[15]
5.0 Windows 7 and later
Windows Server 2008 R2 and later
N/A

Tools

Name Publisher Description License
7-Zip Igor Pavlov 7-Zip is an open source file archiver utility, and can extract the contents of MSI files.[16] GNU Lesser General Public License
EMCO MSI Package Builder EMCO Software An installation editor that allows creating new MSI packages and converting non-silent EXE setups to silent MSI packages for unattended remote installation. Shareware
InstallShield Flexera Software InstallShield is a software tool for creating installers or software packages primarily used for installing software for Microsoft Windows desktop and server platforms. Shareware
Orca Microsoft Orca is a database table editor for creating and editing Windows Installer packages and merge modules. Freeware
Visual Studio Microsoft Visual Studio 2002 through 2010 is capable of building Windows Installer Deployment projects that can create installer packages.[17] Microsoft has dropped support for deployment projects in 2012 and recommends using WiX instead.[12] Shareware
WiX CodePlex WiX (Windows Installer XML) is a free and open-source set of tools that helps build a Windows Installer packages from an XML document. It can be either used from command-line or integrated into Microsoft Visual Studio. SharpDevelop, a free and open-source alternative to Visual Studio, has adopted WiX.[18] Common Public License

See also

References

  1. 1 2 "Released Versions of Windows Installer". Microsoft Developer Network. Microsoft. Retrieved 3 November 2012.
  2. "File Extension .MSI Details". Filext.com. Retrieved 2013-04-24.
  3. when setup isn't just xcopy
  4. "Windows Installer Components". MSDN Library. Microsoft Corporation. 2012-11-30. Retrieved 2013-04-08.
  5. Rollback Installation
  6. Advertisement
  7. Installation-On-Demand
  8. Administrative Installation
  9. "Debugging Custom Actions (Windows)". Msdn.microsoft.com. 2012-11-30. Retrieved 2013-04-24.
  10. Extracting files from a .MSI file from the command line
  11. How to extract MSI files from the command line/prompt in Windows XP/Vista/7
  12. 1 2 Buck Hodges (2011-03-17). "Visual Studio setup projects (vdproj) will not ship with future versions of VS". MSDN Blogs.
  13. Internal Consistency Evaluators – ICEs
  14. What's New in Windows Installer 4.5
  15. "Released Versions of Windows Installer (Windows)". Msdn.microsoft.com. 2012-11-30. Retrieved 2013-04-24.
  16. "Windows Installer Tools & Tips". InstallSite Stefan Krueger. Retrieved 19 November 2009.
  17. "Windows Installer Deployment". Microsoft Developers Network (MSDN) Library. Microsoft Corporation. August 2008. Retrieved 1 October 2009. Windows Installer deployment enables you to create installer packages to be distributed to users; the user runs the setup file and steps through a wizard to install the application.
  18. "SharpDevelop Features". IC#Code. Retrieved 31 March 2012.
This article is issued from Wikipedia - version of the 11/9/2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.