Düzenle

Aracılığıyla paylaş


Installer.ProvideComponent method

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