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

Installer.ProvideComponent method

· 52CE 我爱测

The ProvideComponent method of the Installer object returns the full component path and performs any necessary installation.

The ProvideComponent method of the Installer object returns the full component path and performs any necessary installation. If necessary, the ProvideComponent method of the Installer object prompts for the source and increments the usage count for the feature.

Syntax

Installer.ProvideComponent(
  Product,
  Feature,
  Component,
  InstallMode
)

Parameters

Product

Specifies the product code of the product.

Feature

Specifies the feature ID of the feature containing the component.

Component

Specifies the component code.

InstallMode

Defines the installation mode. This parameter can be one of the values shown in the following table.

Name Meaning
msiInstallModeDefault 0 Provides the component path, performing any installation, if necessary.
msiInstallModeExisting –1 Provides the component path only if the feature exists; otherwise, returns an empty string. This mode verifies the existence of the component's key file.
msiInstallModeNoDetection –2 Provides the component path only if the feature exists. Otherwise, returns an empty string. This mode checks the component's registration but does not verify the existence of the component's key file.
msiInstallModeNoSourceResolution –3 Provides the component path only if the feature exists with an InstallState parameter of msiInstallStateLocal. This checks the component's registration but does not verify the existence of the component's key file.
combination of the msiReinstallMode flags Calls ReinstallFeature to reinstall the feature using this parameter for the ReinstallMode parameter, and then provides the component.

Return value

This method does not return a value.

Remarks

The ProvideComponent method combines the functionality of UseFeature, ConfigureFeature, and ComponentPath. The ProvideComponent method simplifies the calling sequence, but it also increments the usage count and should be used with caution to prevent inaccurate usage counts. The ProvideComponent method also provides less flexibility than a series of individual calls to the methods and properties previously mentioned.

If the application is recovering from an unexpected situation, the application has probably already called UseFeature and incremented the usage count. In this case, the application should avoid incrementing the usage count by calling the ConfigureFeature method instead of the ProvideComponent method.

The msiInstallModeExisting option cannot be used in combination with msiReinstallMode flags.

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 on Windows Server 2003 or Windows XP
DLL Msi.dll
IID IID_IInstaller is defined as 000C1090-0000-0000-C000-000000000046

See also

MsiProvideComponent

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)

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

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