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
Parameters
- productCode (String)
- Product code of the installed product
Return Value
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 |