大网数据广告活动
安装更新与部署

Installer.ApplyPatch method

· 52CE 我爱测

For each product listed by the patch package as eligible to receive the patch, the ApplyPatch method of the Installer object invokes an installation and sets the PATCH property to the path of the patch package.

For each product listed by the patch package as eligible to receive the patch, the ApplyPatch method of the Installer object invokes an installation and sets the PATCH property to the path of the patch package.

Syntax

Installer.ApplyPatch(
  PatchPackage,
  InstallPackage,
  InstallType,
  CommandLine
)

Parameters

PatchPackage

Specifies a path to the patch package.

InstallPackage

If InstallType is set to msiInstallTypeNetworkImage, InstallPackage specifies the path to the product that is to be patched. If InstallType is set to msiInstallTypeDefault and InstallPackage is set to 0, the installer applies the patch to every eligible product listed in the patch package.

If InstallType is msiInstallTypeSingleInstance, the installer applies the patch to the product specified by InstallPackage. In this case, other eligible products listed in the patch package are ignored and the InstallPackage parameter contains the null-terminated string representing the product code of the instance to patch. This type of installation requires the Windows Installer version shipped with the Windows Server 2003 or later or Windows Installer XP SP1 or later.

InstallType

This parameter specifies the type of installation to patch. The InstallType parameter is ignored if InstallPackage is omitted.

Value Meaning
msiInstallTypeNetworkImage Indicates a administrative installation. In this case, InstallPackage must be set to a package path. A value of 1 for msiInstallTypeNetworkImage specifies a administrative installation.
msiInstallTypeDefault Searches system for products to patch. In this case, InstallPackage must be an empty string.
msiInstallSingleInstance Patch the product specified by InstallPackage. InstallPackage is the product code of the instance to patch. This type of installation requires the Windows Installer version shipped with Windows Server 2003 or later or Windows Installer XP SP1 or later. For more information see, Installing Multiple Instances of Products and Patches.

CommandLine

Specifies property settings being set on the command line. See Remarks section.

Return value

This method does not return a value.

Remarks

Because the list delimiter for transforms, sources, and patches is a semicolon, this character should not be used for file names or paths.

The REINSTALL property is required when applying a small update or minor upgrade patch. Without this property, the patch is registered on the system but cannot update files.

Windows Installer 2.0: You must set the REINSTALL property on the command line when applying a small update or minor upgrade patch. For patches that do not use a Custom Action Type 51 to automatically set the REINSTALL and REINSTALLMODE properties, the REINSTALL property must be explicitly set with the CommandLine parameter. Set the REINSTALL property to list the features affected by the patch, or use a practical default setting of "REINSTALL=ALL". The default value of the REINSTALLMODE property is "omus".

Windows Installer 3.0 and later: Beginning with Windows Installer version 3.0, the REINSTALL property is configured by the installer and does not need to be set on the command line.

Requirements

Requirement Value
Version Windows Installer 5.0 on Windows Server 2012, Windows 8, Windows Server 2008 R2 or Windows 7. Windows Installer 4.0 or Windows Installer 4.5 on Windows Server 2008 or Windows Vista. Windows Installer 3.0 or later on Windows Server 2003 or Windows XP.
DLL Msi.dll
IID IID_IInstaller is defined as 000C1090-0000-0000-C000-000000000046

See also

MsiApplyPatch

About Properties

Not Supported in Windows Installer 2.0 and earlier

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。