Deployment Tools Foundation
OpenProduct Method (productCode)
Deployment Tools Foundation Namespaces ► Microsoft.Deployment.WindowsInstaller ► Installer ► OpenProduct(String)
Opens an installer package for an installed product using the product code.
Declaration Syntax
C# | Visual Basic | Visual C++ | F# |
public static Session OpenProduct( string productCode )
Public Shared Function OpenProduct ( productCode As String ) As Session
public: static Session^ OpenProduct( String^ productCode )
static member OpenProduct : productCode : string -> Session
Parameters
- productCode (String)
- Product code of the installed product
Return Value
Session
A Session object allowing access to the product database and install engine, or null if the specified product is not installed.
A Session object allowing access to the product database and install engine, or null if the specified product is not installed.
Remarks
Note that only one Session object can be opened by a single process. OpenProduct cannot be used in a custom action because the active installation is the only session allowed.
The Session object should be Close()()()()d after use. It is best that the handle be closed manually as soon as it is no longer needed, as leaving lots of unused handles open can degrade performance.
Win32 MSI API: MsiOpenProduct
Exceptions
Exception | Condition |
---|---|
ArgumentException | An unknown product was requested |
InstallerException | The product could not be opened |
InstallerException | The installer configuration data is corrupt |
Assembly: Microsoft.Deployment.WindowsInstaller (Module: Microsoft.Deployment.WindowsInstaller.dll) Version: 3.0.0.0 (3.11.1.2318)