Installer::ProvideAssembly Method

Windows Installer

Installer::ProvideAssembly Method

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

Syntax

Script
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

VersionWindows Installer 5.0 on 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
DLLMsi.dll
IIDIID_IInstaller is defined as 000C1090-0000-0000-C000-000000000046

See Also

Installer

Send comments about this topic to Microsoft

Build date: 8/13/2009

© 2009 Microsoft Corporation. All rights reserved.