InstallPackage Class
Provides access to powerful build, maintenance, and analysis operations on an installation package (.MSI or .MSM).
Methods
Section titled “Methods”| Method | Description |
|---|---|
| ApplyPatch(patchPackage, transform) | Applies a patch package to the database, resulting in an installation package that has the patch built-in. |
| Consolidate(mediaCabinet) | Consolidates a package by combining and re-compressing all files into a single internal or external cabinet. |
| ExtractFiles() | Extracts all files to the «see P:WixToolset.Dtf.WindowsInstaller.Package.InstallPackage.WorkingDirectory» . The files are extracted to the relative directory matching their «see P:WixToolset.Dtf.WindowsInstaller.Package.InstallPath.SourcePath» . |
| FindFiles(longFileName) | Gets the list of file keys that have the specified long file name. |
| FindFiles(pattern) | Gets the list of file keys whose long file names match a specified regular-expression search pattern. |
| LogMessage(format, args) | Sends a message to the «see E:WixToolset.Dtf.WindowsInstaller.Package.InstallPackage.Message» event-handler. |
| UpdateDirectories() | Rebuilds the cached directory structure information accessed by the «see P:WixToolset.Dtf.WindowsInstaller.Package.InstallPackage.Directories» and «see P:WixToolset.Dtf.WindowsInstaller.Package.InstallPackage.Files» properties. This should be done after modifying the File, Component, or Directory tables, or else the cached information may no longer be accurate. |
| UpdateFiles() | Updates the install package with new files from the «see P:WixToolset.Dtf.WindowsInstaller.Package.InstallPackage.WorkingDirectory» . The files must be in the relative directory matching their «see P:WixToolset.Dtf.WindowsInstaller.Package.InstallPath.SourcePath» . This method re-compresses and packages the files if necessary, and also updates the following data: File.FileSize, File.Version, File.Language, MsiFileHash.HashPart* |
Properties
Section titled “Properties”| Property | Description |
|---|---|
| CompressionLevel | Gets or sets the compression level used by «see M:WixToolset.Dtf.WindowsInstaller.Package.InstallPackage.UpdateFiles» and «see M:WixToolset.Dtf.WindowsInstaller.Package.InstallPackage.Consolidate(System.String)» . |
| Directories | Gets a mapping from Directory keys to source/target paths. |
| Files | Gets a mapping from File keys to source/target paths. |
| Property | Accessor for getting and setting properties of the InstallPackage database. |
| SourceDirectory | Gets or sets the location to obtain source files and cabinets when extracting or updating files in the working directory. This is often the location of an original copy of the package that is not meant to be modified. |
| WorkingDirectory | Gets or sets the location where files will be extracted to/updated from. Also the location where a temporary folder is created during some operations. |
Events
Section titled “Events”| Event | Description |
|---|---|
| Message | Handle this event to receive status messages when operations are performed on the install package. |
WixToolset.Dtf.WindowsInstaller.Package.dll version 5.0.0+41e11442b2ca93e444b60213b5ae99dcbab787d8 |
ApplyPatch(patchPackage, transform) Method
Section titled “ApplyPatch(patchPackage, transform) Method”Applies a patch package to the database, resulting in an installation package that has the patch built-in.
Declaration
Section titled “Declaration”public void ApplyPatch( PatchPackage patchPackage, string transform)Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
| patchPackage | PatchPackage | The patch package to be applied |
| transform | string | Optional name of the specific transform to apply. This parameter is usually left null, which causes the patch to be searched for a transform that is valid to apply to this database. |
Remarks
Section titled “Remarks”If the patch contains any binary file patches, they will not immediately be applied to the target files, though they will at installation time.After calling this method you can use «see M:WixToolset.Dtf.WindowsInstaller.Package.InstallPackage.Consolidate(System.String)» to apply the file patches immediately and also discard any outdated files from the package.
Consolidate(mediaCabinet) Method
Section titled “Consolidate(mediaCabinet) Method”Consolidates a package by combining and re-compressing all files into a single internal or external cabinet.
Declaration
Section titled “Declaration”public void Consolidate( string mediaCabinet)Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
| mediaCabinet | string |
Remarks
Section titled “Remarks”If an installation package was built from many merge modules, this method can somewhat decrease package size, complexity, and installation time.This method will also convert a package with all or mostly uncompressed files into a package where all files are compressed. If the package contains any not-yet-applied binary file patches (for example, a package generated by a call to «see M:WixToolset.Dtf.WindowsInstaller.Package.InstallPackage.ApplyPatch(WixToolset.Dtf.WindowsInstaller.Package.PatchPackage,System.String)» ) then this method will apply the patches before compressing the updated files. This method edits the database summary information and the File, Media and Patch tables as necessary to maintain a valid installation package. The cabinet compression level used during re-cabbing can be configured with the «see P:WixToolset.Dtf.WindowsInstaller.Package.InstallPackage.CompressionLevel» property.
ExtractFiles() Method
Section titled “ExtractFiles() Method”Extracts all files to the «see P:WixToolset.Dtf.WindowsInstaller.Package.InstallPackage.WorkingDirectory» . The files are extracted to the relative directory matching their «see P:WixToolset.Dtf.WindowsInstaller.Package.InstallPath.SourcePath» .
Declaration
Section titled “Declaration”public void ExtractFiles()Remarks
Section titled “Remarks”If any files have the uncompressed attribute, they will be copied from the «see P:WixToolset.Dtf.WindowsInstaller.Package.InstallPackage.SourceDirectory» .
FindFiles(longFileName) Method
Section titled “FindFiles(longFileName) Method”Gets the list of file keys that have the specified long file name.
Declaration
Section titled “Declaration”public System.String[] FindFiles( string longFileName)Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
| longFileName | string | File name to search for (case-insensitive) |
Return value
Section titled “Return value”System.String[] Array of file keys, or a 0-length array if none are found
FindFiles(pattern) Method
Section titled “FindFiles(pattern) Method”Gets the list of file keys whose long file names match a specified regular-expression search pattern.
Declaration
Section titled “Declaration”public System.String[] FindFiles( System.Text.RegularExpressions.Regex pattern)Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
| pattern | System.Text.RegularExpressions.Regex | Regular expression search pattern |
Return value
Section titled “Return value”System.String[] Array of file keys, or a 0-length array if none are found
LogMessage(format, args) Method
Section titled “LogMessage(format, args) Method”Sends a message to the «see E:WixToolset.Dtf.WindowsInstaller.Package.InstallPackage.Message» event-handler.
Declaration
Section titled “Declaration”protected void LogMessage( string format, System.Object[] args)Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
| format | string | Message string, containing 0 or more format items |
| args | System.Object[] | Items to be formatted |
UpdateDirectories() Method
Section titled “UpdateDirectories() Method”Rebuilds the cached directory structure information accessed by the «see P:WixToolset.Dtf.WindowsInstaller.Package.InstallPackage.Directories» and «see P:WixToolset.Dtf.WindowsInstaller.Package.InstallPackage.Files» properties. This should be done after modifying the File, Component, or Directory tables, or else the cached information may no longer be accurate.
Declaration
Section titled “Declaration”public void UpdateDirectories()UpdateFiles() Method
Section titled “UpdateFiles() Method”Updates the install package with new files from the «see P:WixToolset.Dtf.WindowsInstaller.Package.InstallPackage.WorkingDirectory» . The files must be in the relative directory matching their «see P:WixToolset.Dtf.WindowsInstaller.Package.InstallPath.SourcePath» . This method re-compresses and packages the files if necessary, and also updates the following data: File.FileSize, File.Version, File.Language, MsiFileHash.HashPart*
Declaration
Section titled “Declaration”public void UpdateFiles()Remarks
Section titled “Remarks”The cabinet compression level used during re-cabbing can be configured with the «see P:WixToolset.Dtf.WindowsInstaller.Package.InstallPackage.CompressionLevel» property.
CompressionLevel Property
Section titled “CompressionLevel Property”Gets or sets the compression level used by «see M:WixToolset.Dtf.WindowsInstaller.Package.InstallPackage.UpdateFiles» and «see M:WixToolset.Dtf.WindowsInstaller.Package.InstallPackage.Consolidate(System.String)» .
Declaration
Section titled “Declaration”public WixToolset.Dtf.Compression.CompressionLevel CompressionLevel { get; set; }Remarks
Section titled “Remarks”If the Directory table is modified, this mapping will be outdated until you close and reopen the install package.
Directories Property
Section titled “Directories Property”Gets a mapping from Directory keys to source/target paths.
Declaration
Section titled “Declaration”public InstallPathMap Directories { get; set; }Remarks
Section titled “Remarks”If the Directory table is modified, this mapping will be outdated until you call «see M:WixToolset.Dtf.WindowsInstaller.Package.InstallPackage.UpdateDirectories» .
Files Property
Section titled “Files Property”Gets a mapping from File keys to source/target paths.
Declaration
Section titled “Declaration”public InstallPathMap Files { get; set; }Remarks
Section titled “Remarks”If the File, Component, or Directory tables are modified, this mapping may be outdated until you call «see M:WixToolset.Dtf.WindowsInstaller.Package.InstallPackage.UpdateDirectories» .
Property Property
Section titled “Property Property”Accessor for getting and setting properties of the InstallPackage database.
Declaration
Section titled “Declaration”public InstallPackageProperties Property { get; set; }SourceDirectory Property
Section titled “SourceDirectory Property”Gets or sets the location to obtain source files and cabinets when extracting or updating files in the working directory. This is often the location of an original copy of the package that is not meant to be modified.
Declaration
Section titled “Declaration”public string SourceDirectory { get; set; }WorkingDirectory Property
Section titled “WorkingDirectory Property”Gets or sets the location where files will be extracted to/updated from. Also the location where a temporary folder is created during some operations.
Declaration
Section titled “Declaration”public string WorkingDirectory { get; set; }Message Event
Section titled “Message Event”Handle this event to receive status messages when operations are performed on the install package.
Declaration
Section titled “Declaration”public InstallPackageMessageHandler MessageInstallPackageMessageHandler