WixSharp.UI The standard Install Scope dialog Initializes a new instance of the class. Required designer variable. Clean up any resources being used. true if managed resources should be disposed; otherwise, false. Required method for Designer support - do not modify the contents of this method with the code editor. The standard Exit dialog Initializes a new instance of the class. Required designer variable. Clean up any resources being used. true if managed resources should be disposed; otherwise, false. Required method for Designer support - do not modify the contents of this method with the code editor. Equivalent of Microsoft.Deployment.WindowsInstaller.FeatureInfo which is read-only and doesn't work anyway (at least in WiX v3.9) The name of the Feature The name of the parent Feature The title of the Feature The description of the Feature The view of the Feature. Typically a TreeNode The parent FeatureItem The requested state. Defines the InstallState of the feature to be achieved as the result of the MSI execution. The current state. Defines the InstallState of the feature before the MSI execution. Defines how the feature should be displayed in the feature tree. Determines the initial display of this feature in the feature tree. Determines the order and initial display of this feature in the feature tree. It is a raw value of the `Display` attribute of the `Feature` WiX element. Gets a value indicating whether the feature is allowed to be "absent". true if "disallow absent"; otherwise, false. Initializes a new instance of the class. Initializes a new instance of the class. The session. The name. Returns a that represents this instance. A that represents this instance. Detects the state of the feature. The session. The name. The standard Features dialog. Required designer variable. Clean up any resources being used. true if managed resources should be disposed; otherwise, false. Required method for Designer support - do not modify the contents of this method with the code editor. The logical equivalent of the standard Features dialog. Though it implement slightly different user experience as it has checkboxes bound to the features instead of icons context menu as MSI dialog has. Initializes a new instance of the class. The collection of the features selected by user as the features to be installed. The initial/default set of selected items (features) before user made any selection(s). Required designer variable. Clean up any resources being used. true if managed resources should be disposed; otherwise, false. Required method for Designer support - do not modify the contents of this method with the code editor. The base class for all WinForm based dialogs of ManagedUI. The following is an example of defining installation directory Progam Files/My Company/My Product containing a single file MyApp.exe and subdirectory Documentation with UserManual.pdf file. public partial class CustomDialog : ManagedForm, IManagedDialog { public UserNameDialog() { //instantiate banner PictureBox and back/next/cancel Buttons InitializeComponent(); } void CustomDialog_Load(object sender, EventArgs e) { banner.Image = Runtime.Session.GetResourceBitmap("WixUI_Bmp_Banner"); } void back_Click(object sender, EventArgs e) { Shell.GoPrev(); } void next_Click(object sender, EventArgs e) { Shell.GoNext(); } void cancel_Click(object sender, EventArgs e) { Shell.Cancel(); } } Gets or sets the UI shell (main UI window). This property is set the ManagedUI runtime (IManagedUI). On the other hand it is consumed (accessed) by the UI dialog (IManagedDialog). The shell. Gets the MSI runtime context. The msi runtime. Gets the installer runtime context. The installer runtime. Processes information and progress messages sent to the user interface. This method directly mapped to the . Type of the message. The message record. The buttons. The icon. The default button. Called when Shell is changed. It is a good place to initialize the dialog to reflect the MSI session (e.g. localize the view). Called when MSI execution is complete. Called when MSI execute started. Called when MSI execution progress is changed. The progress percentage. Localizes the form and its contained from the specified localization delegate 'localize'. The method substitutes both localization file (*.wxl) entries and MSI properties contained by the input string with their translated/converted values. Note that both localization entries and MSI properties must be enclosed in the square brackets (e.g. "[ProductName] Setup", "[InstallDirDlg_Title]"). Sets the size of the shell. The width. The height. Set of extension methods for working with ManagedUI dialogs Determines whether the feature checkbox is checked. The feature. Resets the whether the feature checkbox checked state to the initial stat. The feature. Returns default 'is to be installed' state of teh feature. The feature. Returns the FeatireItem bound to the TreeNode. The node. Converts TreeNodeCollection into the TreeNode array. The nodes. Aggregates all nodes of the TreeView control. The tree view. The standard Maintenance Type dialog Initializes a new instance of the class. Required designer variable. Clean up any resources being used. true if managed resources should be disposed; otherwise, false. Required method for Designer support - do not modify the contents of this method with the code editor. The standard Welcome dialog Initializes a new instance of the class. Required designer variable. Clean up any resources being used. true if managed resources should be disposed; otherwise, false. Required method for Designer support - do not modify the contents of this method with the code editor. The standard InstallDir dialog Initializes a new instance of the class. Required designer variable. Clean up any resources being used. true if managed resources should be disposed; otherwise, false. Required method for Designer support - do not modify the contents of this method with the code editor. The standard Licence dialog Initializes a new instance of the class. Required designer variable. Clean up any resources being used. true if managed resources should be disposed; otherwise, false. Required method for Designer support - do not modify the contents of this method with the code editor. The standard Setup Type dialog Initializes a new instance of the class. Required designer variable. Clean up any resources being used. true if managed resources should be disposed; otherwise, false. Required method for Designer support - do not modify the contents of this method with the code editor. The standard Installation Progress dialog Initializes a new instance of the class. Called when Shell is changed. It is a good place to initialize the dialog to reflect the MSI session (e.g. localize the view). Processes the message. Type of the message. The message record. The buttons. The icon. The default button. Called when MSI execution progress is changed. The progress percentage. Called when MSI execution is complete. Handles the Click event of the cancel control. The source of the event. The instance containing the event data. Required designer variable. Clean up any resources being used. true if managed resources should be disposed; otherwise, false. Required method for Designer support - do not modify the contents of this method with the code editor. A strongly-typed resource class, for looking up localized strings, etc. Returns the cached ResourceManager instance used by this class. Overrides the current thread's CurrentUICulture property for all resource lookups using this strongly typed resource class. Looks up a localized string similar to {\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang3081{\fonttbl{\f0\fswiss\fprq2\fcharset0 Tahoma;}{\f1\fnil\fcharset0 Calibri;}} {\*\generator Riched20 6.3.9600}\viewkind4\uc1 \pard\b\f0\fs22\lang1033 Common Public License Version 1.0\par \b0\fs20\par THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.\par \par \par 1. DEFINITIONS \par \par "Contri [rest of string was truncated]";. Looks up a localized resource of type System.Drawing.Bitmap. Looks up a localized resource of type System.Drawing.Bitmap. Looks up a localized resource of type System.Byte[]. The ISession interface controls the installation process. Gets or sets the string value of a named installer property. The session context object. Returns a collection of FeatureItem Returns the value of the named property of the specified object. It can be uses as a generic way of accessing the properties as it redirects (transparently) access to the if the session is terminated (e.g. in deferred custom actions). The name. Returns the resource bitmap. The name on resource. Returns the resource data. The name on resource. Returns the resource string. The name on resource. Gets the target system directory path based on specified directory name. The name. Gets a value indicating whether the product is being installed. This method will fail to retrieve the correct value if called from the deferred custom action and the session properties that it depends on are not preserved with 'UsesProperties' or 'DefaultUsesProperties'. true if installing; otherwise, false. Gets a value indicating whether the product is being repaired. This method will fail to retrieve the correct value if called from the deferred custom action and the session properties that it depends on are not preserved with 'UsesProperties' or 'DefaultUsesProperties'. Determines whether MSI is running in "uninstalling" mode. This method will fail to retrieve the correct value if called from the deferred custom action and the session properties that it depends on are not preserved with 'UsesProperties' or 'DefaultUsesProperties'. Writes a message to the log, if logging is enabled. The line to be written to the log The MsiSessionAdapter object controls the installation process. The MSI session object. Initializes a new instance of the class. The session. Gets or sets the string value of a named installer property. The session context object. Returns a collection of FeatureItem Returns the value of the named property of the specified object. It can be uses as a generic way of accessing the properties as it redirects (transparently) access to the if the session is terminated (e.g. in deferred custom actions). The name. Returns the resource bitmap. The name on resource. Returns the resource data. The name on resource in the Binary table. Returns the resource string. The name on resource. Gets the target system directory path based on specified directory name. The name. Gets a value indicating whether the product is being installed. This method will fail to retrieve the correct value if called from the deferred custom action and the session properties that it depends on are not preserved with 'UsesProperties' or 'DefaultUsesProperties'. true if installing; otherwise, false. Gets a value indicating whether the product is being repaired. This method will fail to retrieve the correct value if called from the deferred custom action and the session properties that it depends on are not preserved with 'UsesProperties' or 'DefaultUsesProperties'. Determines whether MSI is running in "uninstalling" mode. This method will fail to retrieve the correct value if called from the deferred custom action and the session properties that it depends on are not preserved with 'UsesProperties' or 'DefaultUsesProperties'. Writes a message to the log, if logging is enabled. The line to be written to the log Implements as standard dialog-based MSI embedded UI. This class allows defining separate sequences of UI dialogs for 'install' and 'modify' MSI executions. The dialog sequence can contain any mixture of built-in standard dialogs and/or custom dialogs (Form inherited from ). The following is an example of installing MyLibrary.dll assembly and registering it in GAC. ... project.ManagedUI = new ManagedUI(); project.ManagedUI.InstallDialogs.Add(Dialogs.Welcome) .Add(Dialogs.Licence) .Add(Dialogs.SetupType) .Add(Dialogs.Features) .Add(Dialogs.InstallDir) .Add(Dialogs.Progress) .Add(Dialogs.Exit); project.ManagedUI.ModifyDialogs.Add(Dialogs.MaintenanceType) .Add(Dialogs.Features) .Add(Dialogs.Progress) .Add(Dialogs.Exit); The default implementation of ManagedUI. It implements all major dialogs of a typical MSI UI. The default implementation of ManagedUI with no UI dialogs. Initializes a new instance of the class. This method is called (indirectly) by Wix# compiler just before building the MSI. It allows embedding UI specific resources (e.g. license file, properties) into the MSI. The project. Validates the UI text file (localization file) for being compatible with ManagedUI. The file. if set to true [throw on error]. Gets or sets the id of the 'installdir' (destination folder) directory. It is the directory, which is bound to the input UI elements of the Browse dialog (e.g. WiX BrowseDlg, Wix# InstallDirDialog). The install dir identifier. Sequence of the dialogs to be displayed during the installation of the product. Sequence of the dialogs to be displayed during the customization of the installed product. A window icon that appears in the left top corner of the UI shell window. Initializes the specified session. The session. The resource path. The UI level. Processes information and progress messages sent to the user interface. Message type. Record that contains message data. Message buttons. Message box icon. Message box default button. Result of processing the message.

Win32 MSI API: EmbeddedUIHandler

Shuts down the embedded UI at the end of the installation. If the installation was canceled during initialization, this method will not be called. If the installation was canceled or failed at any later point, this method will be called at the end.

Win32 MSI API: ShutdownEmbeddedUI

Defines WiX Managed CustomAction. Managed CustomAction can be defined either in the Wix# script or in the external assembly or C# file. The only requirements for any C# method to be qualified for being Managed CustomAcyion is to have DTF Action signature public static ActionResult MyManagedAction(Session session), and be marked with [CustomAction] attribute. If Managed CustomAction depends on any assembly, which will not be registered with GAC on the target system such assembly needs to be listed in the . often needs to be executed with the elevated privileges. Thus after instantiation it will have set to false and set to Execute.deferred to allow elevating. The following is an example of using MyManagedAction method of the class CustomActions as a Managed CustomAction. class Script { static public void Main(string[] args) { var project = new Project("My Product", new Dir(@"%ProgramFiles%\My Company\My Product", new File(@"AppFiles\MyApp.exe", new WixSharp.Shortcut("MyApp", @"%ProgramMenu%\My Company\My Product"), new WixSharp.Shortcut("MyApp", @"%Desktop%")), new File(@"AppFiles\Readme.txt"), new ManagedAction(@"MyManagedAction"), ... Compiler.BuildMsi(project); } } public class CustomActions { [CustomAction] public static ActionResult MyManagedAction(Session session) { MessageBox.Show("Hello World!", "Managed CA"); return ActionResult.Success; } } Initializes a new instance of the class. Initializes a new instance of the class with properties/fields initialized with specified parameters. Name of the CustomAction. The name should match the method implementing the custom action functionality. Initializes a new instance of the class with properties/fields initialized with specified parameters. The explicit to be associated with instance. Name of the CustomAction. The name should match the method implementing the custom action functionality. Initializes a new instance of the class with properties/fields initialized with specified parameters. Name of the CustomAction. The name should match the method implementing the custom action functionality. Path to the assembly containing the CustomAction implementation. Specify "%this%" if the assembly is in the Wix# script. Initializes a new instance of the class with properties/fields initialized with specified parameters. The explicit to be associated with instance. Name of the CustomAction. The name should match the method implementing the custom action functionality. Path to the assembly containing the CustomAction implementation. Specify "%this%" if the assembly is in the Wix# script. Represents MSI runtime context. This class is to be used by ManagedUI dialogs to interact with the MSI session. The session object. Initializes a new instance of the class. The session. Invokes Client Handlers Represents MSI runtime context. This class is to be used by ManagedUI dialogs to interact with the MSI session. Starts the execution of the MSI installation. Cancels the execution of the MSI installation, which is already started (progress is displayed). The session object. Invokes Client Handlers Repository of the session properties to be captured and transfered to the deferred CAs. Localization map. Initializes a new instance of the class. The session. Gets the bitmap from the MSI embedded resources ('Binary' table). The name. Localizes the specified text. The localization is performed according two possible scenarios. The method will return the match form the MSI embedded localization file. However if it cannot find the match the method will try to find the and return the match from the MSI session properties. This method is mainly used by 'LocalizeWith' extension for a single step localization of WinForm controls. The text. The product name The directory the product is to be installed. This field will contain a valid path only after the MSI execution started. The product code The product version Localization map. It is nothing else but a specialized version of a generic string-to-string Dictionary. Initializes from WiX localization data (*.wxl). The WXL file bytes. Gets or sets the value associated with the specified key. The key. Defines Wix# bootstrapper managed application with no User Interface. It is a design time 'adapter' for the canonical WiX managed bootstrapper application . automatically handles events and detects the current package/product state (present vs. absent). The package state detection is based on the . If this member is no t then the Id of the lats package in the Bundle will be used instead. var bootstrapper = new Bundle("My Product", new PackageGroupRef("NetFx40Web"), new MsiPackage("product.msi")); bootstrapper.AboutUrl = "https://github.com/oleg-shilo/wixsharp/"; bootstrapper.IconFile = "app_icon.ico"; bootstrapper.Version = new Version("1.0.0.0"); bootstrapper.UpgradeCode = new Guid("6f330b47-2577-43ad-9095-1861bb25889b"); bootstrapper.Application = new SilentBootstrapperApplication(); bootstrapper.Build(); Initializes a new instance of the class. The primary package identifier. Initializes a new instance of the class. Automatically generates required sources files for building the Bootstrapper. It is used to automatically generate the files which, can be generated automatically without user involvement (e.g. BootstrapperCore.config). The output directory. Gets or sets the downgrade warning message. The message is displayed when bundle detects a newer version of primary package is installed and the setup is about to exit. The default value is "A later version of the package (PackageId: {0}) is already installed. Setup will now exit.". The downgrade warning message. Implements canonical WiX managed bootstrapper application without any UI. Entry point that is called when the Bootstrapper application is ready to run. Method that gets invoked when the Bootstrapper PlanComplete event is fired. If the planning was successful, it instructs the Bootstrapper Engine to install the packages. Method that gets invoked when the Bootstrapper DetectPackageComplete event is fired. Checks the PackageId and sets the installation scenario. The PackageId is the ID specified in one of the package elements (msipackage, exepackage, msppackage, msupackage) in the WiX bundle. Method that gets invoked when the Bootstrapper ApplyComplete event is fired. This is called after a bundle installation has completed. Make sure we updated the view. Set of ManagedUI dialogs (WinForm) that implement all standard MSI UI dialogs. The standard Welcome dialog The standard Licence dialog The standard Features dialog The standard InstallDir dialog The standard InstallScope dialog The standard Installation Progress dialog The standard Setup Type dialog. To be used during the installation of the product. The standard Maintenance Type dialog.To be used during the maintenance of the product. The standard Exit dialog Gets and sets the current dialog of the UI sequence. The current dialog. MsiRuntime object associated with the ManagedUI shell. The shell. MsiRuntime object associated with the ManagedUI dialog. The dialog. Session object associated with the ManagedUI dialog. The dialog. Gets the target system directory path based on specified directory name (MSI Directory table). The session. The name. Localizes the control its contained from the specified localization delegate 'localize'. The method substitutes both localization file (*.wxl) entries and MSI properties contained by the input string with their translated/converted values. Note that both localization entries and MSI properties must be enclosed in the square brackets (e.g. "[ProductName] Setup", "[InstallDirDlg_Title]"). The control. The localize. Localizes the string from the specified localization delegate 'localize'. The method substitutes both localization file (*.wxl) entries and MSI properties contained by the input string with their translated/converted values. Note that both localization entries and MSI properties must be enclosed in the square brackets (e.g. "[ProductName] Setup", "[InstallDirDlg_Title]"). The text to localize. The localize. Interface of the main window implementation of the MSI external/embedded UI. This interface is designed to be used by Wix#/MSI runtime (e.g. ManagedUI). It is the interface that is directly bound to the (e.g. ). Shows the modal window of the MSI UI. This method is called by the when it is initialized at runtime. The MSI runtime. The MSI external/embedded UI. Called when MSI execution is complete. Called when MSI execute started. Processes information and progress messages sent to the user interface. This method directly mapped to the . Type of the message. The message record. The buttons. The icon. The default button. The main window WinForms implementation of the MSI external/embedded UI. Gets the runtime context object. Typically this object is of the type. The runtime context. Gets or sets the runtime context object. Typically this object is of the type. The runtime context. Gets or sets the UI. The UI. Gets a value indicating whether the MSI session was interrupted (canceled) by user. true if it was user interrupted; otherwise, false. Gets a value indicating whether MSI session ended with error. true if error was detected; otherwise, false. Gets or sets the custom error description to be displayed in the ExitDialog in case of being set to true. The custom error description. Gets the MSI installation errors. The errors. Starts the execution of the MSI installation. Gets the sequence of the UI dialogs specific for the current setup type (e.g. install vs. modify). The dialogs. Gets the current dialog of the UI sequence. The current dialog. Gets or sets the current dialog by the dialog index. The index of the current dialog. Shows the modal window of the MSI UI. This method is called by the when it is initialized at runtime. The MSI runtime. The MSI external/embedded UI. Plays the specified dialogs in demo mode. The dialogs. Plays the specified dialog in demo mode. Plays the specified dialog in demo mode. The dialog. Gets or sets a value indicating whether the UIShell is demo mode. true if this instance is demo mode; otherwise, false. Proceeds to the next UI dialog. Moves to the previous UI Dialog. Moves to the UI Dialog by the specified index in the sequence. The index. Moves to the UI Dialog by the specified dialog type in the sequence. Moves to the UI Dialog by the last dialog in the sequence. Exits this MSI UI application. Cancels the MSI installation. Message dialog handler. Processes information and progress messages sent to the user interface. This method directly mapped to the . Type of the message. The message record. The buttons. The icon. The default button. Gets the MSI log text. The log. Called when MSI execute started. Called when MSI execution is complete. Marshaling the action execution into UI thread The action. Called when MSI execution progress is changed. The progress percentage. Set of Win32 API wrappers Defines System.Windows.Forms., which is to be used as the for custom MSI dialog. As opposite to the WixSharp. based custom dialogs WixCLRDialog is instantiated not at compile but at run time. Thus it is possible to implement comprehensive deployment algorithms in any of the available Form event handlers. The usual usability scenario is the injection of the managed Custom Action (for displaying the WixCLRDialog) into the sequence of the standard dialogs (WixSharp.). While it is possible to construct instance manually it is preferred to use Factory methods of (e.g. InjectPostLicenseClrDialog) for this. static public void Main() { ManagedAction showDialog; var project = new Project("CustomDialogTest", showDialog = new ShowClrDialogAction("ShowProductActivationDialog")); project.UI = WUI.WixUI_Common; project.CustomUI = CustomUIBuilder.InjectPostLicenseClrDialog(showDialog.Id, " LicenseAccepted = \"1\""); Compiler.BuildMsi(project); } ... public class CustomActions { [CustomAction] public static ActionResult ShowProductActivationDialog(Session session) { return WixCLRDialog.ShowAsMsiDialog(new CustomDialog(session)); } } ... public partial class CustomDialog : WixCLRDialog { private GroupBox groupBox1; private Button cancelBtn; ... The all communications with the installation in progress are to be done by modifying the MSI properties or executing MSI actions via Session object. When closing the dialog make sure you set the DeialogResul properly. WixCLRDialog offers three predefined routines for setting the DialogResult: - MSINext - MSIBack - MSICancel By invoking these routines from the corresponding event handlers you can control your MSI UI sequence: void cancelBtn_Click(object sender, EventArgs e) { MSICancel(); } void nextBtn_Click(object sender, EventArgs e) { MSINext(); } void backBtn_Click(object sender, EventArgs e) { MSIBack(); } The MSI session The WIN32 handle to the host window (parent MSI dialog). Initializes a new instance of the class. This constructor is to be used by the Visual Studio Form designer only. You should always use WixCLRDialog(Session session) constructor instead. Initializes a new instance of the class. The session. Inits this instance. Gets the msi foreground window. There is some strange resizing artifact (at least on Win7) when MoveWindow does not resize the window accurately. Thus special adjustment ('delta') is needed to fix the problem. The delta value is used in the ReplaceHost method. 'Replaces' the current step dialog with the "itself". It uses WIN32 API to hide the parent native MSI dialog and place managed form dialog (itself) at the same desktop location and with the same size as the parent. Restores parent native MSI dialog after the previous ReplaceHost call. Closes the dialog and sets the this.DialogResult to the 'DialogResult.Cancel' value ensuring the setup is canceled. Closes the dialog and sets the this.DialogResult to the 'DialogResult.Retry' value ensuring the setup is resumed with the previous UI sequence dialog is displayed. Closes the dialog and sets the this.DialogResult to the 'DialogResult.OK' value ensuring the setup is resumed and the UI sequence advanced to the next step. Shows as specified managed dialog. It uses WIN32 API to hide the parent native MSI dialog and place managed form dialog at the same desktop location and with the same size as the parent. It also ensures that after the managed dialog is closed the proper ActionResult is returned. The dialog. ActionResult value Gets the embedded MSI binary stream. The binary id. Stream instance Tracks MSI progress messages and converts them to usable progress. Gets a number between 0 and 1 that indicates the overall installation progress.