Skip to content

InstallPackage Class

Provides access to powerful build, maintenance, and analysis operations on an installation package (.MSI or .MSM).

MethodDescription
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*
PropertyDescription
CompressionLevelGets 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)» .
DirectoriesGets a mapping from Directory keys to source/target paths.
FilesGets a mapping from File keys to source/target paths.
PropertyAccessor for getting and setting properties of the InstallPackage database.
SourceDirectoryGets 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.
WorkingDirectoryGets or sets the location where files will be extracted to/updated from. Also the location where a temporary folder is created during some operations.
EventDescription
MessageHandle 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.

public void ApplyPatch(
PatchPackage patchPackage,
string transform
)
ParameterTypeDescription
patchPackagePatchPackageThe patch package to be applied
transformstringOptional 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.

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.

Consolidates a package by combining and re-compressing all files into a single internal or external cabinet.

public void Consolidate(
string mediaCabinet
)
ParameterTypeDescription
mediaCabinetstring

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.

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» .

public void ExtractFiles()

If any files have the uncompressed attribute, they will be copied from the «see P:WixToolset.Dtf.WindowsInstaller.Package.InstallPackage.SourceDirectory» .

Gets the list of file keys that have the specified long file name.

public System.String[] FindFiles(
string longFileName
)
ParameterTypeDescription
longFileNamestringFile name to search for (case-insensitive)

System.String[] Array of file keys, or a 0-length array if none are found

Gets the list of file keys whose long file names match a specified regular-expression search pattern.

public System.String[] FindFiles(
System.Text.RegularExpressions.Regex pattern
)
ParameterTypeDescription
patternSystem.Text.RegularExpressions.RegexRegular expression search pattern

System.String[] Array of file keys, or a 0-length array if none are found

Sends a message to the «see E:WixToolset.Dtf.WindowsInstaller.Package.InstallPackage.Message» event-handler.

protected void LogMessage(
string format,
System.Object[] args
)
ParameterTypeDescription
formatstringMessage string, containing 0 or more format items
argsSystem.Object[]Items to be formatted

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.

public void UpdateDirectories()

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*

public void UpdateFiles()

The cabinet compression level used during re-cabbing can be configured with the «see P:WixToolset.Dtf.WindowsInstaller.Package.InstallPackage.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)» .

public WixToolset.Dtf.Compression.CompressionLevel CompressionLevel { get; set; }

If the Directory table is modified, this mapping will be outdated until you close and reopen the install package.

Gets a mapping from Directory keys to source/target paths.

public InstallPathMap Directories { get; set; }

If the Directory table is modified, this mapping will be outdated until you call «see M:WixToolset.Dtf.WindowsInstaller.Package.InstallPackage.UpdateDirectories» .

Gets a mapping from File keys to source/target paths.

public InstallPathMap Files { get; set; }

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» .

Accessor for getting and setting properties of the InstallPackage database.

public InstallPackageProperties Property { get; set; }

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.

public string SourceDirectory { get; set; }

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.

public string WorkingDirectory { get; set; }

Handle this event to receive status messages when operations are performed on the install package.

public InstallPackageMessageHandler Message

InstallPackageMessageHandler