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

Installer::ProvideAssembly method

· 52CE 我爱测

The ProvideAssembly method of the Installer object returns the installed path of an assembly.

The ProvideAssembly method of the Installer object returns the installed path of an assembly.

Syntax

retVal = .ProvideAssembly(
  assembly,
  appContext,
  installMode,
  assemblyInfo
)

Parameters

assembly

The strong name of installed assembly that is to be queried.

appContext

Set to null for global assemblies. For private assemblies, set appContext to the full path of the application configuration file or to the full path of the executable file of the application to which the assembly has been made private.

installMode

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

Value Meaning
msiInstallModeDefault 0 Provide the component and perform any installation necessary to provide the component.
msiInstallModeExisting -1 Provide the component only if the feature exists. This option will verify that the assembly exists.
msiInstallModeNoDetection -2 Provide the component only if the feature exists. This option does not verify that the assembly exists.
msiInstallModeNoSourceResolution -3 Provides the assembly only if the assembly is installed local.
Combination of the flags used by ReinstallFeature Calls the ReinstallFeature method to reinstall the feature using this parameter for ReinstallMode, and then returns the assembly path.

assemblyInfo

Assembly information and assembly type. Set to one of the following values.

Value Meaning
msiProvideAssemblyNet 0 A .NET assembly.
msiProvideAssemblyWin32 1 A Win32 side-by-side assembly.

Return value

The path to the installed assembly.

Remarks

The ProvideAssembly method uses the MsiProvideAssembly function.

Examples

The following sample script demonstrates the use of the ProvideAssembly method.

Dim installer
Set installer = CreateObject("WindowsInstaller.Installer")

'
' ProvideAssembly - .NET global
'   
MsgBox Installer.ProvideAssembly("System.Security,Version=""1.0.5000.0"",PublicKeyToken=""b03f5f7f11d50a3a"",Culture=""neutral"",FileVersion=""1.1.4322.573""", vbNullString, 0, 0)

'
' ProvideAssembly - .NET private
'   
MsgBox Installer.ProvideAssembly("Sample,Version=""1.0.0.0"",Culture=""neutral""", "C:\Program Files\Microsoft\Sample\Sample.exe", 0, 0)

'
' ProvideAssembly - win32 global
'
MsgBox Installer.ProvideAssembly("Microsoft.MSXML2,publicKeyToken=""6bd6b9abf345378f"",version=""4.1.0.0"",type=""win32"",processorArchitecture=""x86""", vbNullString , -2, 1)

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

See also

Installer

Not Supported in Windows Installer 3.1 and earlier versions

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)

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

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