Upravit

Sdílet prostřednictvím


Patching Initial Installations

A Windows Installer Patch (MSP) can be applied when installing an application for the first time by using the PATCH property.

To apply a patch the first time the application is installed, the PATCH property must be set on the command line. Specify the full path to the patch on the command line as the "PATCH={path to patch}" property-value pair.

Note that specifying the PATCH property on the command line overrides the patch applicability checks performed when using MsiApplyPatch or the /p Command Line Option.

If a patch is applied using MsiApplyPatch or the /p Command Line Option, the installer compares the applications currently installed on the computer to the list of product codes eligible to receive the patch in the Template Summary property.

When you set the PATCH property on the command line to install on first installation, the applications eligible to receive the patch is determined by validation conditions on the transforms embedded in the patch package. The recommended method for generating a patch package is to use a patch creation tool such as Msimsp.exe and PATCHWIZ.DLL. The validation conditions on transforms in the patch originate from the ProductValidateFlags column in the TargetImages table of the Patch Creation Properties (.pcp) file.

The patch can be applied the first time the application is installed by a command line, another application, or script.

The following shows first-time patching from the command line.

msiexec /I package.msi PATCH="c:\directory\patch.msp"

The following shows first-time patching from another application.

UINT uiStat = MsiInstallProduct(_T("package.msi"), _T("PATCH=c:\directory\patch.msp"));

The following shows first-time patching from script.

Dim Installer as Object
Set Installer = CreateObject("WindowsInstaller.Installer")
Installer.InstallProduct "package.msi", "PATCH=c:\directory\patch.msp"

**Windows Installer 3.0 and later:  **

Beginning with Windows Installer version 3.0, multiple patches can be applied when installing an application for the first time. Set the PATCH property to a semicolon delimited list of the patches' full paths. The following shows first-time patching of multiple patches from the command line.

msiexec /I package.msi PATCH="c:\directory\patch.msp;c:\directory\patch2.msp;c:\directory\patch3.msp"