C# | Visual Basic | Visual C++ | F# |
public static Session OpenPackage( Database database, bool ignoreMachineState )
Public Shared Function OpenPackage ( database As Database, ignoreMachineState As Boolean ) As Session
public: static Session^ OpenPackage( Database^ database, bool ignoreMachineState )
static member OpenPackage : database : Database * ignoreMachineState : bool -> Session
- database (Database)
- Database used to create the session
- ignoreMachineState (Boolean)
- Specifies whether or not the create a Session object that ignores the computer state and that is incapable of changing the current computer state. A value of false yields the normal behavior. A value of true creates a "safe" Session object that cannot change of the current machine state.
A Session object allowing access to the product database and install engine
Note that only one Session object can be opened by a single process. OpenPackage cannot be used in a custom action because the active installation is the only session allowed.
A "safe" Session object ignores the current computer state when opening the package and prevents changes to the current computer state.
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 APIs: MsiOpenPackage, MsiOpenPackageEx
Exception | Condition |
---|---|
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)