C# Class WixSharp.Project

Represents Wix# project. This class defines the WiX/MSI entities and their relationships.

Project instance can be compiled into complete MSI or WiX source file with one of the Compiler "Build" methods.

Use Project non-default constructor or C# initializers to specify required installation components.

Inheritance: WixSharp.WixProject
ファイルを表示 Open project: Eun/WixSharp Class Usage Examples

Public Properties

Property Type Description
Actions Action[]
AutoAssignedInstallDirPath string
BackgroundImage string
BannerImage string
Binaries WixSharp.Binary[]
Certificates WixSharp.Certificate[]
ControlPanelInfo ProductInfo
CustomUI WixSharp.Controls.CustomUI
DefaultRefAssemblies List
Description string
Dirs WixSharp.Dir[]
EmbeddedUI Binary
EmitConsistentPackageId bool
Encoding System.Text.Encoding
EnvironmentVariables WixSharp.EnvironmentVariable[]
InstallScope InstallScope?
InstallerVersion int
LaunchConditions List
LicenceFile string
LocalizationFile string
MajorUpgrade MajorUpgrade
MajorUpgradeStrategy MajorUpgradeStrategy
Media Media
Package Package
Platform Platform?
ProductId Guid?
Properties Property[]
RegValues WixSharp.RegValue[]
SqlDatabases SqlDatabase[]
UI WUI
UpgradeCode Guid?
Users WixSharp.User[]
Version System.Version

Private Properties

Property Type Description
Preprocess void

Public Methods

Method Description
BuildMsi ( string path = null ) : string

Builds the MSI file from the specified Project instance.

BuildMsiCmd ( string path = null ) : string

Builds the WiX source file and generates batch file capable of building MSI with WiX toolset.

BuildMsm ( string path = null ) : string

Builds the MSM file from the specified Project instance.

BuildMsmCmd ( string path = null ) : string

Builds the WiX source file and generates batch file capable of building MSM with WiX toolset.

BuildWxs ( Compiler type = Compiler.OutputType.MSI, string path = null ) : string

Builds the WiX source file (*.wxs) from the specified Project instance.

CalculateProductId ( System.Guid productGuid, System.Version version ) : System.Guid

Calculates the product id.

FindDir ( string path ) : Dir

Finds T:WixSharp.Dir corresponding to the specified path. new Project("MyProduct", new Dir("%ProgramFiles%", new Dir("My Company", new Dir("My Product", ... In the sample above the call FindDir(@"%ProgramFiles%\My Company\My Product") returns the last declared T:WixSharp.Dir.

FindFile ( Predicate match ) : WixSharp.File[]

Returns all Files of the Project matching the match pattern.

GenerateProductGuids ( ) : void

Generates all missing product Guids (e.g. UpgradeCode and ProductId).

Wix# compiler call this method just before building the MSI. However you can call it any time if you want to preview auto-generated Guids.

Project ( ) : System

Initializes a new instance of the Project class.

Project ( string name ) : System

Initializes a new instance of the Project class.

ResolveWildCards ( bool ignoreEmptyDirectories = false ) : Project

Resolves all wild card specifications if any.

This method is called by Compiler during the compilation. However it might be convenient to call it before the compilation if any files matching the wild card mask need to be handled in special way (e.g. shortcuts created). See WildCard Files example.

ResolveWildCards should be called only after T:WixSharp.WixProject.SourceBaseDir is set. Otherwise wild card paths may not be resolved correctly.

Private Methods

Method Description
Preprocess ( ) : void

Method Details

BuildMsi() public method

Builds the MSI file from the specified Project instance.
public BuildMsi ( string path = null ) : string
path string The path to the MSI file to be build.
return string

BuildMsiCmd() public method

Builds the WiX source file and generates batch file capable of building MSI with WiX toolset.
public BuildMsiCmd ( string path = null ) : string
path string The path to the batch file to be build.
return string

BuildMsm() public method

Builds the MSM file from the specified Project instance.
public BuildMsm ( string path = null ) : string
path string The path to the MSM file to be build.
return string

BuildMsmCmd() public method

Builds the WiX source file and generates batch file capable of building MSM with WiX toolset.
public BuildMsmCmd ( string path = null ) : string
path string The path to the batch file to be build.
return string

BuildWxs() public method

Builds the WiX source file (*.wxs) from the specified Project instance.
public BuildWxs ( Compiler type = Compiler.OutputType.MSI, string path = null ) : string
type Compiler The type () of the setup file to be defined in the source file (MSI vs. MSM).
path string The path to the WXS file to be build.
return string

CalculateProductId() public static method

Calculates the product id.
public static CalculateProductId ( System.Guid productGuid, System.Version version ) : System.Guid
productGuid System.Guid The product GUID.
version System.Version The version.
return System.Guid

FindDir() public method

Finds T:WixSharp.Dir corresponding to the specified path. new Project("MyProduct", new Dir("%ProgramFiles%", new Dir("My Company", new Dir("My Product", ... In the sample above the call FindDir(@"%ProgramFiles%\My Company\My Product") returns the last declared T:WixSharp.Dir.
public FindDir ( string path ) : Dir
path string The path string.
return Dir

FindFile() public method

Returns all Files of the Project matching the match pattern.
public FindFile ( Predicate match ) : WixSharp.File[]
match Predicate The match pattern.
return WixSharp.File[]

GenerateProductGuids() public method

Generates all missing product Guids (e.g. UpgradeCode and ProductId).

Wix# compiler call this method just before building the MSI. However you can call it any time if you want to preview auto-generated Guids.

public GenerateProductGuids ( ) : void
return void

Project() public method

Initializes a new instance of the Project class.
public Project ( ) : System
return System

Project() public method

Initializes a new instance of the Project class.
public Project ( string name ) : System
name string The name of the project. Typically it is the name of the product to be installed.
return System

ResolveWildCards() public method

Resolves all wild card specifications if any.

This method is called by Compiler during the compilation. However it might be convenient to call it before the compilation if any files matching the wild card mask need to be handled in special way (e.g. shortcuts created). See WildCard Files example.

ResolveWildCards should be called only after T:WixSharp.WixProject.SourceBaseDir is set. Otherwise wild card paths may not be resolved correctly.
public ResolveWildCards ( bool ignoreEmptyDirectories = false ) : Project
ignoreEmptyDirectories bool if set to true empty directories are ignored and not added to the project.
return Project

Property Details

Actions public_oe property

Collection of Actionss to be performed during the installation.
public Action[] Actions
return Action[]

AutoAssignedInstallDirPath public_oe property

Name (path) of the directory which was assigned T:WixSharp.Compiler.AutoGeneration.InstallDirDefaultId ID as part of XML auto-generation (see T:WixSharp.AutoGenerationOptions).
public string AutoAssignedInstallDirPath
return string

BackgroundImage public_oe property

Path to the file containing the image (e.g. bmp) setup dialogs background. If not specified default image will be used.
public string BackgroundImage
return string

BannerImage public_oe property

Path to the file containing the image (e.g. bmp) setup dialogs banner. If not specified default image will be used.
public string BannerImage
return string

Binaries public_oe property

Collection of WiX/MSI Binary objects to be embedded into MSI database. Normally you doe not need to deal with this property as Compiler will populate it automatically.
public Binary[],WixSharp Binaries
return WixSharp.Binary[]

Certificates public_oe property

Collection of Certificate to be installed.
public Certificate[],WixSharp Certificates
return WixSharp.Certificate[]

ControlPanelInfo public_oe property

Set of values in 'Add/Remove Programs' of Control Panel.
public ProductInfo ControlPanelInfo
return ProductInfo

CustomUI public_oe property

The custom UI definition. Use CustomUIBuilder to generate the WiX UI definition or compose WixSharp.Controls.CustomUI manually.
public CustomUI,WixSharp.Controls CustomUI
return WixSharp.Controls.CustomUI

DefaultRefAssemblies public_oe property

Collection of paths to the assemblies referenced by ManagedActions.
public List DefaultRefAssemblies
return List

Description public_oe property

The product full name or description.
public string Description
return string

Dirs public_oe property

Collection of Dirs to be installed.
public Dir[],WixSharp Dirs
return WixSharp.Dir[]

EmbeddedUI public_oe property

The Binary (assembly) implemening WiX embedded UI
public Binary,WixSharp EmbeddedUI
return Binary

EmitConsistentPackageId public_oe property

Indicates whether compiler should emit consistent package Id (package code). Set EmitConsistentPackageId to 'false' (default value) if you want the WiX compilers automatically generate a new package code for each new .msi file built. Or set it to 'true' if you want Wix# to auto generate a unique consistent package code for a given combination of the product code, product version and product upgrade code.

WiX package code generation policy discourages the use of this attribute as it is a primary MSI identifier used to distinguish packages in ARP. Thus WiX tools always auto-generate the code for each build. This in turn makes it impossible to rebuild a truly identical MSIs from the same WiX code even with the same set of product code, version and upgrade code.

This very artificial limitation has severe practical impact. For example if a specific MSI file is lost it cannot be recreated even if the original source code that was used to built the lost MSI is available.

From another hand Wix# encourages using a singe GUID (Project.GUID) as a primary identifier of the product. Thus all other MSI identifiers can be derived by the compiler from the unique combination of this GUID and the product version. This also included generation of the package Id attribute controlled by the EmitConsistentPackageId.

Wix# does not changes the WiX default package code generation it just gives the opportunity to control it when required.

public bool EmitConsistentPackageId
return bool

Encoding public_oe property

The Encoding to be used for MSI UI dialogs. If not specified the System.Text.Encoding.Default will be used.
public Encoding,System.Text Encoding
return System.Text.Encoding

EnvironmentVariables public_oe property

Collection of EnvironmentVariables to be set during the installation.
public EnvironmentVariable[],WixSharp EnvironmentVariables
return WixSharp.EnvironmentVariable[]

InstallScope public_oe property

Use this attribute if you need to specify the installation scope of this package: per-machine or per-user.
public InstallScope? InstallScope
return InstallScope?

InstallerVersion public_oe property

The installer version
public int InstallerVersion
return int

LaunchConditions public_oe property

Collection of the T:WixSharp.LaunchConditions associated with the setup.
public List LaunchConditions
return List

LicenceFile public_oe property

Relative path to RTF file with the custom licence agreement to be displayed in the Licence dialog. If this value is not specified the default WiX licence agreement will be used.
public string LicenceFile
return string

LocalizationFile public_oe property

Path to the Localization file.
public string LocalizationFile
return string

MajorUpgrade public_oe property

Simplifies authoring for major upgrades, including support for preventing downgrades.
public MajorUpgrade,WixSharp MajorUpgrade
return MajorUpgrade

MajorUpgradeStrategy public_oe property

Defines Major Upgrade behavior. By default it is null thus upgrade is not supported.

If you need to implement Major Upgrade define this member to appropriate MajorUpgradeStrategy instance.

public MajorUpgradeStrategy,WixSharp MajorUpgradeStrategy
return MajorUpgradeStrategy

Media public_oe property

Generic T:WixSharp.WixEntity container for defining WiX Media element attributes.

These attributes describe a disk that makes up the source media for the installation.

The following is an example of defining the Package attributes. var project = new Project("My Product", new Dir(@"%ProgramFiles%\My Company\My Product", ... project.Media.AttributesDefinition = @"Id=2; CompressionLevel=mszip"; Compiler.BuildMsi(project);
public Media Media
return Media

Package public_oe property

Generic T:WixSharp.WixEntity container for defining WiX Package element attributes.

These attributes are the properties about the package to be placed in the Summary Information Stream. These are visible from COM through the IStream interface, and these properties can be seen on the package in Explorer.

The following is an example of defining the Package attributes. var project = new Project("My Product", new Dir(@"%ProgramFiles%\My Company\My Product", ... project.Package.AttributesDefinition = @"AdminImage=Yes; Comments=Release Candidate; Description=Fantastic product..."; Compiler.BuildMsi(project);
public Package Package
return Package

Platform public_oe property

The target platform type.
public Platform? Platform
return Platform?

ProductId public_oe property

This is the value of the Id attribute of the Wix Product element. This value is unique for any given version of a product being installed.

If user doesn't specify this value Wix# engine will derive it from project Project.GUID and the product Project.Version.
public Guid? ProductId
return Guid?

Properties public_oe property

Collection of WiX/MSI Property objects to be created during the installed.
public Property[] Properties
return Property[]

RegValues public_oe property

Collection of RegValues to be set during the installation.
public RegValue[],WixSharp RegValues
return WixSharp.RegValue[]

SqlDatabases public_oe property

Collection of WiX:SqlExtension SqlDatabase objects representing databases to be created, modifed, or interacted with during MSI execution.
public SqlDatabase[] SqlDatabases
return SqlDatabase[]

UI public_oe property

Type of the MSI User Interface. This value is assigned to the UIRef WiX element during the compilation. If specified WUI.WixUI_Minimal will used.
public WUI UI
return WUI

UpgradeCode public_oe property

This is the value of the UpgradeCode attribute of the Wix Product element.

Both WiX and MSI consider this element as optional even it is the only available identifier for defining relationship between different versions of the same product. Wix# in contrary enforces that value to allow any future updates of the product being installed.

If user doesn't specify this value Wix# engine will use Project.GUID as UpgradeCode.

public Guid? UpgradeCode
return Guid?

Users public_oe property

Collection of Wix:UtilExtension User objects representings users 'for all kinds of things'
public User[],WixSharp Users
return WixSharp.User[]

Version public_oe property

Version of the product to be installed.
public Version,System Version
return System.Version