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.
![](collapse_all.gif)
![](collapse_all.gif)
- productCode (String)
- Product code of the installed product
![](collapse_all.gif)
A Session object allowing access to the product database and install engine,
or null if the specified product is not installed.
![](collapse_all.gif)
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
![](collapse_all.gif)
Exception | Condition |
---|---|
ArgumentException | An unknown product was requested |
InstallerException | The product could not be opened |
InstallerException | The installer configuration data is corrupt |