WiX: Setting values as a Composite of Multiple Properties - windows

Is it possible, and if so how can I create a single value from multiple properties within a WiX installation project?
Specifically, I have some dialog like this...
<Dialog Id="ConnectionStringDlg" Width="370"
Height="270" Title="Database Settings - [ProductName]" NoMinimize="yes">
<!-- Connection String -->
<Control Id="TitleLabel" Type="Text" X="45" Y="60" Width="100" Height="15" TabSkip="yes" Text="Connection String" />
<Control Id="DSLabel" Type="Text" X="45" Y="77"
Width="100" Height="15" TabSkip="no" Text="&Data Source: " />
<Control Id="DSEdit" Type="Edit" X="45" Y="92"
Width="220" Height="18" Property="CONNECTION_STRING_DS" Text="{200}" />
<Control Id="ICLabel" Type="Text" X="45" Y="107"
Width="100" Height="15" TabSkip="no" Text="&Initial Catalog: " />
<Control Id="ICEdit" Type="Edit" X="45" Y="122"
Width="220" Height="18" Property="CONNECTION_STRING_IC" Text="{200}" />
<Control Id="UIDLabel" Type="Text" X="45" Y="137"
Width="100" Height="15" TabSkip="no" Text="&User ID: " />
<Control Id="UIDEdit" Type="Edit" X="45" Y="152"
Width="220" Height="18" Property="CONNECTION_STRING_UI" Text="{200}" />
<Control Id="PassLabel" Type="Text" X="45" Y="167"
Width="100" Height="15" TabSkip="no" Text="&Password: " />
<Control Id="PassEdit" Type="Edit" X="45" Y="182" Password="yes"
Width="220" Height="18" Property="CONNECTION_STRING_PASS" Text="{200}" />
<!-- Back button -->
<!--<Control Id="Back" Type="PushButton" X="180" Y="243"
Width="56" Height="17" Text="&Back">
<Publish Event="NewDialog" Value="PoolSettingsDlg">1</Publish>
</Control>-->
<Control Id="Next" Type="PushButton" X="236" Y="243"
Width="56" Height="17" Default="yes" Text="&Next">
<Publish Event="NewDialog" Value="CustomizeDlg">
<!--if settings are correct, allow next dialog-->
<![CDATA[CONNECTION_STRING <> ""]]>
</Publish>
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="243"
Width="56" Height="17" Cancel="yes" Text="Cancel">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0"
Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
<Control Id="Description" Type="Text" X="25" Y="23"
Width="280" Height="15" Transparent="yes" NoPrefix="yes">
<Text>Please enter database configuration</Text>
</Control>
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<Control Id="Title" Type="Text" X="15" Y="6"
Width="200" Height="15" Transparent="yes" NoPrefix="yes">
<Text>{\WixUI_Font_Title}Database Settings</Text>
</Control>
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
</Dialog>
Which I am using to get connection string information from the end user in a user friendly way. I then set this value in a web.config file at install time using...
<Component Id="cmp623DDF82F0F7645ADAAF0E7573713162" Guid="{8CFDC325-BC71-4A2F-AB22-68B0AE56C98B}">
<File Id="fil5B0B918C0DAF7B2ECC5EB9C7CC0B9FFC" KeyPath="yes" Source="Publish\Web.config" />
<util:XmlFile Id="ModifyConnectionString"
Action="setValue"
Permanent="yes"
ElementPath="//configuration/connectionStrings/add[\[]#name='RawConnection'[\]]"
Name="connectionString"
File="[#fil5B0B918C0DAF7B2ECC5EB9C7CC0B9FFC]"
Value="[CONNECTION_STRING]"
SelectionLanguage="XSLPattern"
Sequence="1"/>
</Component>
My question is, how can I set the connection string value by making a composite from multiple properties set in the dialog?

You could use the MSI Community extensions for this as it provides you with a nice interface and will format the string for you.
However if you want to build it up manually you can just do the string building in the Value attribute:
<util:XmlFile Id="ModifyConnectionString"
Action="setValue"
Permanent="yes"
ElementPath="//configuration/connectionStrings/add[\[]#name='RawConnection'[\]]"
Name="connectionString"
File="[#fil5B0B918C0DAF7B2ECC5EB9C7CC0B9FFC]"
Value='Server=[CONNECTION_STRING_DS];Database=[CONNECTION_STRING_IC];User Id=[CONNECTION_STRING_UI];Password=[CONNECTION_STRING_PASS];'
SelectionLanguage="XSLPattern"
Sequence="1"/>
Alternatively if you need to set a single property to use in multiple places you can either use the CustomAction or the SetProperty elements (they both do the same thing):
<CustomAction Id='SetConnectionString'
Property='CONNECTION_STRING'
Before='ExecXmlFile'
Value='Server=[CONNECTION_STRING_DS];Database=[CONNECTION_STRING_IC];User Id=[CONNECTION_STRING_UI];Password=[CONNECTION_STRING_PASS];' />
<SetProperty Id='CONNECTION_STRING'
Before='ExecXmlFile'
Value='Server=[CONNECTION_STRING_DS];Database=[CONNECTION_STRING_IC];User Id=[CONNECTION_STRING_UI];Password=[CONNECTION_STRING_PASS];' />

Related

How to add an hyperlink in custom dialog in WIX

I want to add an hyperlink in my custom dialog in WIx, but currently I am able to add only message not hyperlink. Internet I saw from installer 5.0 onwards hyperlink adding is supported, mine is "Windows ® Installer. V 5.0.18362.1"
Wix I am using is "WiX Toolset v3.11"
My custome dialog
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<UI Id="SetupDialogUI">
<Dialog Id="MyNewDlg" Width="370" Height="270" Title="Waygate Technologies">
<Control Id="background" Type="Bitmap" Text="bgPic" Width="370" Height="234" X="0" Y="0" TabSkip="no" />
<Control Id="introText" Type="Text" X="130" Y="50" Width="350" Height="22" Transparent="yes" Text="{\WixUI_Font_Title}CUDA Toolkit Installation" />
<Control Id="explanationText" X="130" Y="100" NoWrap="no" RightAligned="no" Transparent="yes" Type="Text" Width="250" Height="100" Text=**"Before installing please install dependencies**." />
<Control Id="installButton" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Ok">
<Publish Event="EndDialog" Value="Return">1</Publish>
</Control>
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
</Dialog>
<InstallUISequence>
<Show Dialog="MyNewDlg" Before="ExecuteAction" />
</InstallUISequence>
</UI>
</Fragment>
</Wix>
You simply need a Control Element of the Type "Hyperlink" that contains a formated text, look here.
<Control Id="Link1" Type="Hyperlink" X="135" Y="250" Width="220" Height="60" >
<Text><![CDATA[Click here!]]></Text>
</Control>

How can I add two license agreements to an installer?

I'm new to WiX and I have been working on creating an installer for our application using WiX. I have it correctly installing most of the application and dependencies, but currently it does not have any UI.
I want to add a simple wizard interface and I've read about the Minimal configurations and others, but I have a slightly unusual requirement that I would need two different License style agreements. The first license agreement is a standard license, the second is dealing with government export restrictions.
I've been searching for information on how to set the license agreement in WiX but I'm unsure of how to add two separate screens in which the user must agree to continue? Can you explain how I can add two .RTF files as license agreement wizard pages? Other than that, I do not need a complicated UI, no optional features etc.
What we did was download the source then copy the existing license dialog and modified it (we wanted a release notes dialog so we turned off most of the controls).
We then copied and modified WixMinimalUI set to include the dialog. Below is an example for our release notes dialog, you'd want to uncomment the commented out controls and handle their usage. Additionally we created this in it's own project so that other installers could use it, we added a preprocessor variable releaseNotesRtf that can then be set from other projects, this variable is the path to the second rtf document.
<Fragment>
<UI>
<Dialog Id="ReleaseNotesDlg" Width="370" Height="270" Title="!(loc.LicenseAgreementDlg_Title)">
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.LicenseAgreementDlgBannerBitmap)" />
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<!--<Control Id="Description" Type="Text" X="25" Y="23" Width="340" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.LicenseAgreementDlgDescription)" />-->
<!--<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.LicenseAgreementDlgTitle)" />-->
<!--<Control Id="LicenseAcceptedCheckBox" Type="CheckBox" X="20" Y="207" Width="330" Height="18" CheckBoxValue="1" Property="LicenseAccepted" Text="!(loc.LicenseAgreementDlgLicenseAcceptedCheckBox)" />-->
<Control Id="Print" Type="PushButton" X="112" Y="243" Width="56" Height="17" Text="!(loc.WixUIPrint)">
<Publish Event="DoAction" Value="WixUIPrintEula">1</Publish>
</Control>
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" />
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)">
<Publish Event="SpawnWaitDialog" Value="WaitForCostingDlg">!(wix.WixUICostingPopupOptOut) OR CostingComplete = 1</Publish>
<!--<Condition Action="disable"><![CDATA[LicenseAccepted <> "1"]]></Condition>
<Condition Action="enable">LicenseAccepted = "1"</Condition>-->
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
<Control Id="LicenseText" Type="ScrollableText" X="20" Y="60" Width="330" Height="140" Sunken="yes" TabSkip="no">
<Text SourceFile="!(wix.WixUIReleaseNotesRtf=$(var.releaseNotesRtf))" />
</Control>
</Dialog>
</UI>
<UI Id="WixUI_MinimalReleaseNotes">
<TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
<TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
<TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
<Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
<Property Id="WixUI_Mode" Value="Minimal" />
<DialogRef Id="ErrorDlg" />
<DialogRef Id="FatalError" />
<DialogRef Id="FilesInUse" />
<DialogRef Id="MsiRMFilesInUse" />
<DialogRef Id="PrepareDlg" />
<DialogRef Id="ProgressDlg" />
<DialogRef Id="ResumeDlg" />
<DialogRef Id="UserExit" />
<DialogRef Id="ReleaseNotesDlg"/>
<Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="LicenseAgreementDlg">NOT Installed</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">Installed AND PATCH</Publish>
<Publish Dialog="LicenseAgreementDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
<Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="ReleaseNotesDlg">LicenseAccepted = "1"</Publish>
<Publish Dialog="ReleaseNotesDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
<Publish Dialog="ReleaseNotesDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="ReleaseNotesDlg" Order="1">NOT Installed OR WixUI_InstallMode = "Change"</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed AND NOT PATCH</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="3">Installed AND PATCH</Publish>
<Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>
</UI>
<UIRef Id="WixUI_Common" />
</Fragment>

WiX installer fails with error code 2819

I am trying to create an installer using WiX which doesn't show the license agreement at the start. But I get the error as below.
This is the full Product.wxs file I have at the moment. It compiles and builds OK. Why am I getting an error like this? Is my Fragment section in the right place? I have removed the Publish elements pertaining to license and modified the welcome dialog's next button to show the install directory dialog instead of license agreement. This is as mentioned in the help chm file. What am I missing then?
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="077765d1-236d-4299-b751-f921828f2ac8"
Name="Wix Setup Example"
Language="1033"
Version="1.0.0.0"
Manufacturer="NBL" UpgradeCode="1b0f72a7-8e17-4897-9f96-66509cc39573">
<Package InstallerVersion="200" Compressed="yes" />
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" >
<Directory Id="INSTALLLOCATION" Name="My Application Folder">
<Component Id="ProductComponent" Guid="MY-GUID-HERE">
<File Id="WindowsFormsApp.exe"
Source="../WindowsFormsApp/bin/Debug/WindowsFormsApp.exe">
</File>
</Component>
</Directory>
</Directory>
</Directory>
<Feature Id="ProductFeature" Title="WixSetupProject" Level="1">
<ComponentRef Id="ProductComponent" />
</Feature>
<UI Id="WixUI_Advanced">
<TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
<TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
<TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
<Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
<Property Id="WixUI_Mode" Value="Advanced" />
<DialogRef Id="BrowseDlg" />
<DialogRef Id="DiskCostDlg" />
<DialogRef Id="ErrorDlg" />
<DialogRef Id="FatalError" />
<DialogRef Id="FilesInUse" />
<DialogRef Id="MsiRMFilesInUse" />
<DialogRef Id="PrepareDlg" />
<DialogRef Id="ProgressDlg" />
<DialogRef Id="ResumeDlg" />
<DialogRef Id="UserExit" />
<Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath" Order="3">1</Publish>
<Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="4"><![CDATA[WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
<Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg" Order="1">NOT Installed</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="1">Installed AND PATCH</Publish>
<Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
<Publish Dialog="InstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
<Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath" Order="2">NOT WIXUI_DONTVALIDATEPATH</Publish>
<Publish Dialog="InstallDirDlg" Control="Next" Event="SpawnDialog" Value="InvalidDirDlg" Order="3"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
<Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="4">WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID="1"</Publish>
<Publish Dialog="InstallDirDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
<Publish Dialog="InstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="InstallDirDlg" Order="1">NOT Installed</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed AND NOT PATCH</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">Installed AND PATCH</Publish>
<Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>
<Property Id="ARPNOMODIFY" Value="1" />
</UI>
<UIRef Id="WixUI_Common" />
</Product>
<Fragment>
<Property Id="ApplicationFolderName" Value="My Application Folder" />
<Property Id="WixAppFolder" Value="WixPerMachineFolder" />
<WixVariable Id="WixUISupportPerUser" Value="1" Overridable="yes" />
<WixVariable Id="WixUISupportPerMachine" Value="1" Overridable="yes" />
<PropertyRef Id="ApplicationFolderName" />
</Fragment>
</Wix>
The edited version of the WiX file that gives no error. This version however skips the install feature and browse for the file dialog:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="077765d1-236d-4299-b751-f921828f2ac8"
Name="Wix Setup Example"
Language="1033"
Version="1.0.0.0"
Manufacturer="NBL" UpgradeCode="1b0f72a7-8e17-4897-9f96-66599gg39573">
<Package InstallerVersion="200" Compressed="yes" />
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLLOCATION" Name="My Application Folder">
<Component Id="ProductComponent" Guid="17e13748-8d44-47f6-b020-66d29f8a84fe">
<File Id="WindowsFormsApp.exe"
Source="../WindowsFormsApp/bin/Debug/WindowsFormsApp.exe">
</File>
</Component>
</Directory>
</Directory>
</Directory>
<Feature Id="ProductFeature" Title="WixSetupProject" Level="1">
<ComponentRef Id="ProductComponent" />
</Feature>
<UI Id="WixUI_Advanced">
<TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
<TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
<TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
<Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
<Property Id="WixUI_Mode" Value="Advanced" />
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLLOCATION" />
<DialogRef Id="BrowseDlg" />
<DialogRef Id="DiskCostDlg" />
<DialogRef Id="ErrorDlg" />
<DialogRef Id="FatalError" />
<DialogRef Id="FilesInUse" />
<DialogRef Id="MsiRMFilesInUse" />
<DialogRef Id="PrepareDlg" />
<DialogRef Id="ProgressDlg" />
<DialogRef Id="ResumeDlg" />
<DialogRef Id="UserExit" />
<Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath" Order="3">1</Publish>
<Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="4"><![CDATA[WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
<Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="BrowseDlg" Order="1">1</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="1">1</Publish>
<Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="BrowseDlg">1</Publish>
<Publish Dialog="InstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
<Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath" Order="2">NOT WIXUI_DONTVALIDATEPATH</Publish>
<Publish Dialog="InstallDirDlg" Control="Next" Event="SpawnDialog" Value="InvalidDirDlg" Order="3"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
<Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="4">WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID="1"</Publish>
<Publish Dialog="InstallDirDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
<Publish Dialog="InstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="1">NOT Installed</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed AND NOT PATCH</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">Installed AND PATCH</Publish>
<Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>
<Property Id="ARPNOMODIFY" Value="1" />
</UI>
<UIRef Id="WixUI_Common" />
</Product>
<Fragment>
<Property Id="ApplicationFolderName" Value="My Application Folder" />
<Property Id="WixAppFolder" Value="WixPerMachineFolder" />
<WixVariable Id="WixUISupportPerUser" Value="1" Overridable="yes" />
<WixVariable Id="WixUISupportPerMachine" Value="1" Overridable="yes" />
<PropertyRef Id="ApplicationFolderName" />
<UI >
<Dialog Id="CustomBrowseDlg" Width="370" Height="270" Title="!(loc.BrowseDlg_Title)">
<Control Id="PathEdit" Type="PathEdit" X="25" Y="202" Width="320" Height="18" Property="_BrowseProperty" Indirect="yes" />
<Control Id="OK" Type="PushButton" X="240" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUIOK)">
<Publish Event="SetTargetPath" Value="[_BrowseProperty]">1</Publish>
<Publish Event="EndDialog" Value="Return">1</Publish>
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
<Publish Event="Reset" Value="0">1</Publish>
<Publish Event="EndDialog" Value="Return">1</Publish>
</Control>
<Control Id="ComboLabel" Type="Text" X="25" Y="58" Width="44" Height="10" TabSkip="no" Text="!(loc.BrowseDlgComboLabel)" />
<Control Id="DirectoryCombo" Type="DirectoryCombo" X="70" Y="55" Width="220" Height="80" Property="_BrowseProperty" Indirect="yes" Fixed="yes" Remote="yes">
<Subscribe Event="IgnoreChange" Attribute="IgnoreChange" />
</Control>
<Control Id="WixUI_Bmp_Up" Type="PushButton" X="298" Y="55" Width="19" Height="19" ToolTip="!(loc.BrowseDlgWixUI_Bmp_UpTooltip)" Icon="yes" FixedSize="yes" IconSize="16" Text="!(loc.BrowseDlgWixUI_Bmp_Up)">
<Publish Event="DirectoryListUp" Value="0">1</Publish>
</Control>
<Control Id="NewFolder" Type="PushButton" X="325" Y="55" Width="19" Height="19" ToolTip="!(loc.BrowseDlgNewFolderTooltip)" Icon="yes" FixedSize="yes" IconSize="16" Text="!(loc.BrowseDlgNewFolder)">
<Publish Event="DirectoryListNew" Value="0">1</Publish>
</Control>
<Control Id="DirectoryList" Type="DirectoryList" X="25" Y="83" Width="320" Height="98" Property="_BrowseProperty" Sunken="yes" Indirect="yes" TabSkip="no" />
<Control Id="PathLabel" Type="Text" X="25" Y="190" Width="320" Height="10" TabSkip="no" Text="!(loc.BrowseDlgPathLabel)" />
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.BrowseDlgBannerBitmap)" />
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.BrowseDlgDescription)" />
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.BrowseDlgTitle)" />
</Dialog>
</UI>
</Fragment>
</Wix>
Removing that gets the following error in the MSI logs:
DEBUG: Error 2819: Control Folder on dialog InstallDirDlg needs a property linked to it
Basically this means that the "browse for folder" control isn't linked up to an actual property value. You've used the value INSTALLLOCATION for the application folder - which in turn means you'll need to add the following value to link the dialog:
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLLOCATION" />
Good luck!
My experience is: you should add Property attribute in Control tag. Like:
<Control Id="NameEdit" Type="Edit"
X="45" Y="85" Width="220" Height="18"
Property="USERNAME" Text="{80}" />
Error code 2819 means "Control [3] on dialog [2] needs a property linked to it" (taken from Windows Installer Error Messages). If you extract the MSI traces (add /l*v to the command line) you'll be able to see what [3] and [2] stand for, and continue debugging from there.

Wix installation

On the verge of giving up on Wix as an installer!
The things I want the installer to do
Prompt user for language selection
proceed with installation in selected language
skip the license agreement window
Prompt for feature list
Prompt for folder to install into
install application binaries in selected language
While un-installing, the language should be the language it was installed in.
Of the list above I have only managed to get point 3 to work. However I dont know if it is the correct way. There is no documentation I can find on what tag should nest into what tag. What the property ID names can or cannot be. As per the CHM guidance I have removed the license dialog and specified InstallDirDlg to be the next dialog after the welcome dialog. Inspite of doing that I cant get it to work. It completely skips the point 4 & 5 above and goes straight into the 'confirm to begin installation' window. Clicking next over there installs the product without even asking me which folder or which feature to install.
Questions:
Does the UI and UIRef tag go into the Fragment tag or the Product tag?
What exactly does one put into the Fragment tag?
If I put the entire UI tag into the Fragment tags then the product installs without any UI. That cant be the correct place for it then. Right?
Any other free installer I should look at to meet my installer requirements as above?
The full problem script file is here below as-is.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="077765d1-236d-4299-b751-f921828f2ac8"
Name="A Wix Setup Example"
Language="1033"
Version="1.0.0.0"
Manufacturer="Study Products" UpgradeCode="1b0f72a7-8e17-4897-9f96-66509cc39573">
<Package InstallerVersion="200" Compressed="yes" />
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" >
<Directory Id="INSTALLLOCATION" Name="My Application Folder">
<Component Id="ProductComponent" Guid="17e13748-8d44-47f6-b020-66d29f8a84fe">
<File Id="WindowsFormsApp.exe"
Source="../WindowsFormsApp/bin/Debug/WindowsFormsApp.exe">
</File>
</Component>
</Directory>
</Directory>
</Directory>
<Feature Id="ProductFeature" Title="WixSetupProject" Level="1">
<ComponentRef Id="ProductComponent" />
</Feature>
<UI Id="WixUI_InstallDir">
<TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
<TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
<TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
<Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
<Property Id="WixUI_Mode" Value="Advanced" />
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLLOCATION" />
<DialogRef Id="BrowseDlg" />
<DialogRef Id="DiskCostDlg" />
<DialogRef Id="ErrorDlg" />
<DialogRef Id="FatalError" />
<DialogRef Id="FilesInUse" />
<DialogRef Id="MsiRMFilesInUse" />
<DialogRef Id="PrepareDlg" />
<DialogRef Id="ProgressDlg" />
<DialogRef Id="ResumeDlg" />
<DialogRef Id="UserExit" />
<Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath" Order="3">1</Publish>
<Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="4"><![CDATA[WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
<Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg" Order="1">1</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="1">1</Publish>
<Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
<Publish Dialog="InstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
<Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath" Order="2">NOT WIXUI_DONTVALIDATEPATH</Publish>
<Publish Dialog="InstallDirDlg" Control="Next" Event="SpawnDialog" Value="InvalidDirDlg" Order="3"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
<Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="4">WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID="1"</Publish>
<Publish Dialog="InstallDirDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
<Publish Dialog="InstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="1">NOT Installed</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed AND NOT PATCH</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">Installed AND PATCH</Publish>
<Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>
<Property Id="ARPNOMODIFY" Value="1" />
</UI>
<UIRef Id="WixUI_Common" />
</Product>
<Fragment>
<CustomAction Id="CA_Set_WIXUI_EXITDIALOGOPTIONALTEXT" Property="WIXUI_EXITDIALOGOPTIONALTEXT" Value="Thank you for installing [ProductName]."/>
<InstallUISequence>
<Custom Action="CA_Set_WIXUI_EXITDIALOGOPTIONALTEXT" After="FindRelatedProducts">NOT Installed</Custom>
</InstallUISequence>
<Property Id="ApplicationFolderName" Value="My Application Folder" />
<Property Id="WixAppFolder" Value="WixPerMachineFolder" />
<WixVariable Id="WixUISupportPerUser" Value="1" Overridable="yes" />
<WixVariable Id="WixUISupportPerMachine" Value="1" Overridable="yes" />
<PropertyRef Id="ApplicationFolderName" />
<UI >
<Dialog Id="CustomBrowseDlg" Width="370" Height="270" Title="!(loc.BrowseDlg_Title)">
<Control Id="PathEdit" Type="PathEdit" X="25" Y="202" Width="320" Height="18" Property="_BrowseProperty" Indirect="yes" />
<Control Id="OK" Type="PushButton" X="240" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUIOK)">
<Publish Event="SetTargetPath" Value="[_BrowseProperty]">1</Publish>
<Publish Event="EndDialog" Value="Return">1</Publish>
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
<Publish Event="Reset" Value="0">1</Publish>
<Publish Event="EndDialog" Value="Return">1</Publish>
</Control>
<Control Id="ComboLabel" Type="Text" X="25" Y="58" Width="44" Height="10" TabSkip="no" Text="!(loc.BrowseDlgComboLabel)" />
<Control Id="DirectoryCombo" Type="DirectoryCombo" X="70" Y="55" Width="220" Height="80" Property="_BrowseProperty" Indirect="yes" Fixed="yes" Remote="yes">
<Subscribe Event="IgnoreChange" Attribute="IgnoreChange" />
</Control>
<Control Id="WixUI_Bmp_Up" Type="PushButton" X="298" Y="55" Width="19" Height="19" ToolTip="!(loc.BrowseDlgWixUI_Bmp_UpTooltip)" Icon="yes" FixedSize="yes" IconSize="16" Text="!(loc.BrowseDlgWixUI_Bmp_Up)">
<Publish Event="DirectoryListUp" Value="0">1</Publish>
</Control>
<Control Id="NewFolder" Type="PushButton" X="325" Y="55" Width="19" Height="19" ToolTip="!(loc.BrowseDlgNewFolderTooltip)" Icon="yes" FixedSize="yes" IconSize="16" Text="!(loc.BrowseDlgNewFolder)">
<Publish Event="DirectoryListNew" Value="0">1</Publish>
</Control>
<Control Id="DirectoryList" Type="DirectoryList" X="25" Y="83" Width="320" Height="98" Property="_BrowseProperty" Sunken="yes" Indirect="yes" TabSkip="no" />
<Control Id="PathLabel" Type="Text" X="25" Y="190" Width="320" Height="10" TabSkip="no" Text="!(loc.BrowseDlgPathLabel)" />
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.BrowseDlgBannerBitmap)" />
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.BrowseDlgDescription)" />
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.BrowseDlgTitle)" />
</Dialog>
</UI>
</Fragment>
</Wix>
Sorry for the bad formatting. I fixed it the best I could. Thanks for taking the time to go through this...
Regarding languages, this question might help:
is it possible to create a multilanguage installer using WIX?
The purpose of Fragments are to separate logical parts of your installer. It's not necessary to have a Fragment at all, but it can be nice to put, say the UI portion in a separate file. The reason it's not showing up is because you need to reference it from the Product portion.
These lines from your code are referencing a UI or Dialog elements from elsewhere, for example.
<UIRef Id="WixUI_Common" />
<DialogRef Id="BrowseDlg" />
The other thing you'll need to do is reference your custom dialog in the dialog sequence. That might involve replacing BrowseDlg with your CustomBrowseDlg.
<Publish Dialog="InstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
For retrieving the language, this post might help: the WiX toolsets Remember Property pattern
Windows Installer is pretty complex, but I can't say whether you would be better served trying another technology. Lots of people seem to like NSIS though.

Enable or disable the next button based on a live text control value in Wix? [duplicate]

This question already has answers here:
WIX UI - Creating a "passwords don't match" label
(4 answers)
Closed 6 years ago.
I created a custom dialog page in wix and it has a text box. I want to disable the next button of the installer if the text box is empty end enable it if the user has typed a value. The following code works partially. It does not disable the next button but it does not navigate to the next page unless you fill the value. The problem I have is that the status of the next button is not updated while you are typing a value in the edit text box. If I remove the value from the edit text box and then click back to the previous screen and then next, the next button is disabled.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<UI>
<Dialog Id="MyCustomDialog" Width="370" Height="270" Title="Custom Dialog Options">
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="Next">
<Condition Action="disable">USERNAME1 = ""</Condition>
<Condition Action="enable">NOT(USERNAME1 = "")</Condition>
<Publish Event="NewDialog" Value="VerifyReadyDlg">NOT(USERNAME1 = "")</Publish>
</Control>
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="Back">
<Publish Event="NewDialog" Value="CustomizeDlg">1</Publish>
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="Please type the value" />
<Control Id="UserNameText" Type="Text" X="20" Y="60" Width="290" Height="13" NoPrefix="yes" Text="Please type the username" />
<Control Id="UserNameEdit" Type="Edit" X="20" Y="72" Width="290" Height="18" Multiline="no" Property="USERNAME1"/>
</Dialog>
</UI>
</Fragment>
</Wix>
Disabling and enabling the "Next" button is nearly impossible in WIX. The answer from #Wjdavis5 disabled the "Next" button for me but the button will only enable if the user clicks in another text box. Which is confusing.
The following code is based on this answer. It shows a single text entry box, when the user clicks "Next" it either shows an error dialog, or progresses to the install screen.
<Dialog Id="UserRegistrationDialog" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
<Control Id="UserIdEdit" Type="Edit" X="45" Y="85" Width="220" Height="18" Property="UserID" Text="{80}" />
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="Next" >
<Publish Event="NewDialog" Value="VerifyReadyDlg">2</Publish>
<Publish Event="SpawnDialog" Value="UserIdError"><![CDATA[UserID = ""]]></Publish>
</Control>
</Dialog>
<Dialog Id="UserIdError" Width="260" Height="85" NoMinimize="no" Title="[ProductName]">
<Control Id="UserIdErrorDesc" Type="Text" Width="194" Height="30" X="48" Y="15" Text="Please enter a User ID." />
<Control Id="UserIdErrorOk" Type="PushButton" X="97" Y="57" Width="56" Height="17" Text="Ok">
<Publish Event="EndDialog" Value="Return">1</Publish>
</Control>
</Dialog>
Here is how I did it.
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="&Next">
<Condition Action="enable"><![CDATA[InDBCONNECTION_STRING_VALID = "1"]]></Condition>
<Condition Action="disable"><![CDATA[InDBCONNECTION_STRING_VALID = "0"]]></Condition>
</Control>

Resources