Wix: How to add browse button in Wix - wix

Is there a simple way to add browse button in Wix. I created a custom by modifying from WixUI_InstallDir.wxs. This browse button is in another dialog (not the same one as for locating the installation path). This browse button will be use to specify the path to put my log files that will be created during installation.
EDIT:
sorry about the confusion on "below code". I intended to show the codes initially but the space on the above reply was limited. Here I've added the codes. I manage to show the Browse dialog now but i need to be able to change the path so that it is not same as the Browse dialog path of the installation path which is _BrowseProperty. My code below is using _LogBrowseProperty but i'm not sure how do i properly define it and at where should i define it. Using the code below will generate 2819 error. Can you help to take a look on what is wrong here? Thanks a lot.
CUSTOMDIR is defined in Product.wxs
<Property Id='CUSTOMDIR' Value="TARGETDIR"></Property>
Below is in MyWixUI_InstallDir.wxs
<Control Id="LogFolderLabel" Type="Text" X="20" Y="160" Width="290" Height="30" NoPrefix="yes"
Text="Folder Label" />
<Control Id="LogFolder" Type="PathEdit" X="20" Y="200" Width="320" Height="18" Property="CUSTOMDIR"
Indirect="yes" />
<Control Id="ChangeFolder" Type="PushButton" X="20" Y="220" Width="56" Height="17"
Text="Change Folder" />
....
<Publish Dialog="myDlg" Control="ChangeFolder" Property="_LogBrowseProperty" Value="[CUSTOMDIR]" Order="1">1</Publish>
<Publish Dialog="myDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
<Property Id="_LogBrowseProperty" Value="TARGETDIR" />

I was looking for a while at trying to do the same thing and amended the Wix BroseDlg dialog to achieve this.
In the parent control I had the following path edit and push button controls:
<Control Id="LogFilePathValue" Type="PathEdit" X="50" Y="205" Width="215" Height="18" Property="LOGFILE_PATH"/>
<Control Id="LogFilePathButton" Type="PushButton" X="270" Y="205" Width="50" Height="17" Text="!(loc.LogFilePathButton_Text)">
<Publish Property="LOGFILE_PATH_TEMP" Value="[LOGFILE_PATH]" Order="1">1</Publish>
<Publish Event="SpawnDialog" Value="MyLogFileDialog" Order="2">1</Publish>
</Control>
</Control>
MyLogFileDialog then looked like this:
<Dialog Id="MyLogFileDialog" Width="370" Height="270" Title="!(loc.MyLogFileDialog_DialogTitle)">
<Control Id="PathEdit" Type="PathEdit" X="25" Y="202" Width="320" Height="18" Property="LOGFILE_PATH_TEMP" />
<Control Id="OK" Type="PushButton" X="240" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUIOK)">
<Publish Property="LOGFILE_PATH" Value="[LOGFILE_PATH_TEMP]" Order="1">1</Publish>
<Publish Event="EndDialog" Value="Return" Order="2">1</Publish>
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
<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="LOGFILE_PATH_TEMP" 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="LOGFILE_PATH_TEMP" Sunken="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.MyLogFileDialog_TitleBody)" />
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.MyLogFileDialog_TitleMain)" />
</Dialog>
You then have to make sure the property LOGFILE_PATH is set prior to calling this parent form. In my case I'm using my own version of the UI_Mondo so I set the property after the user has selected the install type:
<Publish Dialog="SetupTypeDlg" Control="TypicalButton" Property="LOGFILE_PATH" Value="[COMPONENTINSTALLFOLDER]\Logs" Order="1">1</Publish>
<Publish Dialog="SetupTypeDlg" Control="TypicalButton" Event="NewDialog" Value="ParentDialogWithLogLocationControls" Order="2">1</Publish>

Try to examine the WiXUIExtension closer, especially the WixUI_InstallDir.wxs and InstallDirDlg.wxs. See how the controls and dialogs are set up in order to handle directory browsing properly and try to adjust it to your needs.
From InstallDirDlg.wxs:
<Control Id="Folder" Type="PathEdit" X="20" Y="100" Width="320" Height="18" Property="WIXUI_INSTALLDIR" Indirect="yes" />
<Control Id="ChangeFolder" Type="PushButton" X="20" Y="120" Width="56" Height="17" Text="!(loc.InstallDirDlgChange)" />
From WixUI_InstallDir.wxs:
<Publish Dialog="InstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1">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>

Related

Issue replacing the default WelcomeDlg dialog

I have managed to add a custom dialog in the middle of the sequence which collects several values from the user and saves them to the registry (in the dialog with ID ApiKeyDlg).
However, I'm having difficulty (5+ hours wasted) replacing the WelcomeDlg with a custom dialog during major upgrades only. I.E. I want to show a custom WelcomeDlg that goes straight to the VerifyReadyDlg for Major Upgrades (detected using Installed OR PREVFOUND).
I have also tried using WIX_UPGRADE_DETECTED, same results.
What am I doing incorrectly here? Is it my condition that is failing or am I misunderstanding the process of editing the sequence?
Light.exe shows no errors, but it fails to either:
Detect that an older version of the app is already installed
Show the UpgradeWelcomeDlg after detecting an old version installed
I'm not sure how I can narrow down which part is failing?
<UI>
<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" />
<DialogRef Id="DiskCostDlg" />
<DialogRef Id="LicenseAgreementDlg" />
<DialogRef Id="VerifyReadyDlg" />
<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="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="LicenseAgreementDlg">NOT Installed OR NOT PREVFOUND</Publish>
<Publish Dialog="UpgradeWelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">Installed OR PREVFOUND</Publish>
<Publish Dialog="LicenseAgreementDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
<Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="ApiKeyDlg">LicenseAccepted = "1"</Publish>
<Publish Dialog="ApiKeyDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
<Publish Dialog="ApiKeyDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg"></Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="ApiKeyDlg" 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="UpgradeWelcomeDlg" Order="2">Installed OR PREVFOUND</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>
<Dialog Id="ApiKeyDlg" Width="370" Height="270" Title="[ProductName] Setup">
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.ProgressDlgBannerBitmap)" />
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)" />
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" />
<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="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="Only the Organisation ID is required unless you're using a web proxy" />
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="Agent configuration" />
<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="ApiKeyLabel" Type="Text" X="20" Y="55" Width="290" Height="10" NoPrefix="yes" Text="Organisation ID (required):" />
<Control Id="ApiKey" Type="Edit" X="20" Y="70" Width="300" Height="18" Property="UI_ORGANISATION" Indirect="yes" />
<Control Id="ProxyAddressLabel" Type="Text" X="20" Y="95" Width="290" Height="10" NoPrefix="yes" Text="Proxy server address (optional):" />
<Control Id="Proxy" Type="Edit" X="20" Y="110" Width="300" Height="18" Property="UI_PROXYADDRESS" Indirect="yes" />
<Control Id="ProxyUsernameLabel" Type="Text" X="20" Y="130" Width="290" Height="10" NoPrefix="yes" Text="Proxy username (leave blank for default):" />
<Control Id="ProxyUsername" Type="Edit" X="20" Y="145" Width="300" Height="18" Property="UI_PROXYUSERNAME" Indirect="yes" />
<Control Id="ProxyPasswordLabel" Type="Text" X="20" Y="165" Width="290" Height="10" NoPrefix="yes" Text="Proxy password (leave blank for default):" />
<Control Id="ProxyPassword" Type="Edit" Password="yes" X="20" Y="180" Width="300" Height="18" Property="UI_PROXYPASSWORD" Indirect="yes" />
<Control Id="ScoutCheckbox" Type="CheckBox" X="20" Y="205" Width="300" Height="17" Property='SCOUTSHORTCUT' CheckBoxValue='1'>
<Text> Create a Start Menu shortcut for SomeApplicationName Scout (optional)</Text>
</Control>
</Dialog>
<Dialog Id="UpgradeWelcomeDlg" Width="370" Height="270" Title="[ProductName] Update">
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)" >
<Publish Property="WixUI_InstallMode" Value="Update">Installed AND PATCH</Publish>
</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="Bitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="234" TabSkip="no" Text="!(loc.WelcomeDlgBitmap)" />
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Disabled="yes" Text="!(loc.WixUIBack)" />
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<Control Id="Description" Type="Text" X="135" Y="80" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="!(loc.WelcomeDlgDescription)" >
</Control>
<Control Id="Title" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="!(loc.WelcomeDlgTitle)" />
</Dialog>
<InstallUISequence>
<Show Dialog="UpgradeWelcomeDlg" Before="ProgressDlg">Installed OR PREVFOUND</Show>
</InstallUISequence>
<UIRef Id="WixUI_Common" />
</UI>
Ultimately, I want to show completely different dialogs for Major Upgrades compared to an initial install.
Well then... I just managed to get it working using this:
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="LicenseAgreementDlg">NOT Installed OR NOT PREVFOUND OR NOT WIX_UPGRADE_DETECTED</Publish>
<Publish Dialog="UpgradeWelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">Installed OR PREVFOUND OR WIX_UPGRADE_DETECTED</Publish>
Perhaps writing this question cleared my mind! Who knows.

How to skip PIDKey requirement for msi, using wix toolset?

I'm creating msi installer, using wix toolset. I need for user inputs, so l used UI Dialog as in documentation: https://www.firegiant.com/wix/tutorial/user-interface/new-link-in-the-chain/
In the Example shown in the link, I removed CDKeyEdit:
<Control Id="CDKeyEdit" Type="MaskedEdit" X="45" Y="159" Width="250" Height="16" Property="PIDKEY" Text="[PIDTemplate]" />
as it is not necessary for my application.
However, installer is showing that key is not valid during installation:
Is there any way to remove the requirement for the PIDKey?
<Publish Event="ValidateProductID" Value="0">1</Publish>
<Publish Event="SpawnWaitDialog" Value="WaitForCostingDlg">CostingComplete = 1</Publish>
<Publish Event="NewDialog" Value="SetupTypeDlg">ProductID</Publish>
Look for these and remove the first one and change the condition on the last one to empty or 1.
Shameless plug: Check out my open source tool IsWiX. It provides templates and designers to learn and use WiX faster.
Tutorials here:
https://github.com/iswix-llc/iswix-tutorials
To include a new custom dialog you simply uncomment one line as shown here:
https://github.com/iswix-llc/iswix-tutorials/blob/master/desktop-application/Installer/DesktopApplication/Code/UI.wxs
The code for the new dialog is shown here:
https://github.com/iswix-llc/iswix-tutorials/blob/master/desktop-application/Installer/DesktopApplication/Code/UI-CustomDialog.wxs
QA: Please remember to test in all installation modes: install, uninstall, modify, repair, self-repair, patching, major upgrade, etc.... Hard to tell how things can conspire, no substitute for real-world testing (just to state the obvious).
UserRegistrationDlg.wxs: Limited to no testing, but here is a suggestion for UserRegistrationDlg.wxs:
<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<UI>
<Dialog Id="UserRegistrationDlg" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes">
<Control Id="NameLabel" Type="Text" X="45" Y="73" Width="100" Height="15" TabSkip="no" Text="&User Name:" />
<Control Id="NameEdit" Type="Edit" X="45" Y="85" Width="220" Height="18" Property="USERNAME" Text="{80}" />
<Control Id="OrganizationLabel" Type="Text" X="45" Y="110" Width="100" Height="15" TabSkip="no" Text="&Organization:" />
<Control Id="OrganizationEdit" Type="Edit" X="45" Y="122" Width="220" Height="18" Property="COMPANYNAME" Text="{80}" />
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&Back">
<Publish Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
</Control>
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="&Next">
<Publish Event="NewDialog" Value="SetupTypeDlg">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="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 your customer information</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}Customer Information</Text>
</Control>
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
</Dialog>
</UI>
</Fragment>
</Wix>
Quick Explanation of Changes: There are only a few things changed.
Take out the actual controls for the CD-Key:
<Control Id="CDKeyLabel" Type="Text" X="45" Y="147" Width="50" Height="10" TabSkip="no">
<Text>CD &Key:</Text>
</Control>
<Control Id="CDKeyEdit" Type="MaskedEdit" X="45" Y="159" Width="250" Height="16" Property="PIDKEY" Text="[PIDTemplate]" />
and remove the associated events for the control:
<Publish Event="ValidateProductID" Value="0">1</Publish>
<Publish Event="SpawnWaitDialog" Value="WaitForCostingDlg">CostingComplete = 1</Publish>
and finally change the ProductID condition to 1 for the Next button on the dialog so that a new dialog is spawned and the key is not validated:
<Publish Event="NewDialog" Value="SetupTypeDlg">1</Publish>

WiX - how do I refresh Edit control after file browse dialog

I am required to have a FileBrowseDialog during a WiX installation. I made my own custom dialog that raises the OpenFileDialog and sets the selected value in the session property (found the code here). I need a way to refresh the Edit control with the selected full path. Right now, after choosing the file, the edit control remains blank. How do I achieve this? I am not an expert in MSI or WiX.
Wix Code:
<UI>
<Dialog Id="DrugsDBFileBrowseDialog" Width="370" Height="270" Title="!(loc.DrugsDBFileDlg_Title)">
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.SetupTypeDlgBannerBitmap)" />
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.DrugsDBFileDlgDescription)" />
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.DrugsDBFileDlgTitle)" />
<Control Type="Edit" Id="txtDrugsFilePath" Width="270" Height="15" X="22" Y="142" Property="DRUGSDBFILEPATH" Text="[DRUGSDBFILEPATH]" />
<Control Type="PushButton" Id="btnBrowse" Width="56" Height="21" X="300" Y="139" Text="&Browse" >
<Publish Event="DoAction" Value="BrowseDBFile" Order="0">1</Publish>
<Publish Event="SpawnDialog" Value="ValidationErrorDlg" Order="1000">ValidationErrorText</Publish>
</Control>
<Control Type="Text" Id="lblInstructions" Width="290" Height="15" X="26" Y="120" Text="!(loc.DrugsDBFileDlgLabelDescription)" />
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<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" Text="!(loc.WixUINext)" />
<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>
</Dialog>
</UI>
Custom Action Code:
[CustomAction]
public static ActionResult BrowseDBFile(Session session)
{
try {
session.Log("Begin OpenFileChooser Custom Action");
var task = new Thread(() => GetFile(session));
task.SetApartmentState(ApartmentState.STA);
task.Start();
task.Join();
session.Log("End OpenFileChooser Custom Action");
} catch (Exception ex) {
session.Log("Exception occurred as Message: {0}\r\n StackTrace: {1}", ex.Message, ex.StackTrace);
return ActionResult.Failure;
}
return ActionResult.Success;
}
private static void GetFile(Session session)
{
OpenFileDialog fileDialog = new OpenFileDialog();
if (fileDialog.ShowDialog() == DialogResult.OK) {
session["DRUGSDBFILEPATH"] = fileDialog.FileName;
}
}
UPDATE
Found out the solution is to invoke the RESET event before performing the action associated to the BROWSE button. I also performed a PUBLISH PROPERTY after performing the custom action. Look below.
<UI>
<Dialog Id="DrugsDBFileBrowseDialog" Width="370" Height="270" Title="!(loc.DrugsDBFileDlg_Title)">
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.SetupTypeDlgBannerBitmap)" />
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.DrugsDBFileDlgDescription)" />
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.DrugsDBFileDlgTitle)" />
<Control Type="Edit" Id="txtDrugsFilePath" Width="270" Height="15" X="22" Y="142" Property="DRUGSDBFILEPATH" Text="[DRUGSDBFILEPATH]" />
<Control Type="PushButton" Id="btnBrowse" Width="56" Height="21" X="300" Y="139" Text="&Browse" >
<Publish Event="Reset" Value="1">1</Publish>
<Publish Event="DoAction" Value="BrowseDBFile" Order="1"><![CDATA[1]]></Publish>
<Publish Property="DRUGSDBFILEPATH" Value="[DRUGSDBFILEPATH]"><![CDATA[1]]></Publish>
</Control>
<Control Type="Text" Id="lblInstructions" Width="290" Height="15" X="26" Y="120" Text="!(loc.DrugsDBFileDlgLabelDescription)" />
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<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" Text="!(loc.WixUINext)" >
<Publish Event="DoAction" Value="ValidateSelectedPath" Order="1">1</Publish>
<Publish Event="SpawnDialog" Value="ValidationErrorDlg" Order="1000">ValidationErrorText</Publish>
</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>
</Dialog>
</UI>
<Control Type="Edit" Id="txtDrugsFilePath" Width="270" Height="15" X="22" Y="142" Property="DRUGSDBFILEPATH" Text="[DRUGSDBFILEPATH]" />
<Control Type="PushButton" Id="btnBrowse" Width="56" Height="21" X="300" Y="139" Text="&Browse" >
<Publish Event="Reset" Value="1">1</Publish>
<Publish Event="DoAction" Value="BrowseDBFile" Order="1"><![CDATA[1]]></Publish>
<Publish Property="DRUGSDBFILEPATH" Value="[DRUGSDBFILEPATH]"><![CDATA[1]]></Publish>
</Control>
<Control Type="Text" Id="lblInstructions" Width="290" Height="15" X="26" Y="120" Text="!(loc.DrugsDBFileDlgLabelDescription)" />
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<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" Text="!(loc.WixUINext)" >
<Publish Event="DoAction" Value="ValidateSelectedPath" Order="1">1</Publish>
<Publish Event="SpawnDialog" Value="ValidationErrorDlg" Order="1000">ValidationErrorText</Publish>
</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>
</Dialog>
</UI>
I did the same with the label
<Control
Type="PushButton"
Id="Browse"
Width="56"
Height="17"
X="281"
Y="125"
Text="Browser"
Property="FILE_PATH" >
<Publish Event="DoAction" Value="CA_TO_OPEN_FILE_BROWSER_DIALOG" Order="1">1</Publish>
<Publish Property="FILE_PATH" Value="[FILE_PATH]">1</Publish>
</Control>
<Control
Type="Text"
Id="LocationLabel"
Width="244"
Height="15"
X="26" Y="126"
Property="FILE_PATH"
Text="[FILE_PATH]"
Sunken="yes"
Indirect="yes"
Disabled="yes">
</Control>

WIX installer - Installing Features based on checkbox selection in UI dialog is not working

Even though Checkbox is not selected, the msi installs all features. I have AddLocal and remove when Next is clicked. Here is the UI code:
<Control Id="SFCheckBox" Type="CheckBox" X="20" Y="80" Width="290" Height="17" Property="SF_FEATURE" CheckBoxValue="0" Integer="yes" Text="iNetSec Smart Finder Sensor Service will be installed." Default="yes" Disabled="yes" />
<Control Id="group_NDCforFEService" Type="CheckBox" X="20" Y="110" Width="290" Height="17" Property="FE_FEATURE" CheckBoxValue="1" Integer="yes" Text="iNetSec Smart Finder FireEye Integration Service will be installed." />
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="&Next">
<Publish Event="DoAction" Value="CostFinalize">1</Publish>
<Publish Event="NewDialog" Value="UserInfoDlg" Order="2">SF_FEATURE</Publish>
<Publish Event="AddLocal" Value="All" Order="3">1</Publish>
<Publish Event="Remove" Value="IntegrationFeatures" Order="4">NOT FE_FEATURE</Publish>
</Control>
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="Back">
<Publish Event="AddLocal" Value="All" Order="3">1</Publish>
<Publish Event="NewDialog" Value="InstallDirDlg" Order="4">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="iNetSec Smart Finder Features." />
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="{\WixUI_Font_Title}iNetSec Smart Finder Features" />
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.InstallDirDlgBannerBitmap)" />
<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" />
</Dialog>
</UI>
The Features in Product is as follows.
I don't know what I am I doing wrong here. Even though I did not select the second checkbox, the "IntegrationFeatures" was installed. When I checked the log file, I see this:
Property(S): ADDLOCAL = IntegrationFeatures,ProductFeature.
Please help.
Thanks,
Ravi
I do not recommend the AddLocal and Remove approach found here for the reasons I listed in the comments which amount to "Install everything and then removing it based on checkbox selection is silly and complicates silent installs".
What you should be doing is adding conditions to your <Feature> nodes like this:
<Feature Id="FeatureA" Level="0">
<Condition Level="1">INSTALLFEATUREA</Condition>
<ComponentGroupRef Id="A_Files" />
</Feature>

InstallScopeDlg in Custom Wix UI not working

Hi i have developed an setup with wix and now i need to ask users wether its AllUser or perUser.After a long research i found that InstallScopeDLg can make it possible.But I have added custom UI with my wix and i wasn't able to add InstallScopeDlg with this custom UI in WIX.
<Publish Dialog="LicenseAgreementDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
<Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="ReadmeDlg" Order="2">LicenseAccepted = "1"</Publish>
<Publish Dialog="MyInstallScopeDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
<Publish Dialog="MyInstallScopeDlg" Control="Next" Event="NewDialog" Value="ReadmeDlg" Order="2"></Publish>
<Publish Dialog="ReadmeDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
<Publish Dialog="ReadmeDlg" Control="Next" Event="NewDialog" Value="CustomizeDlg" Order="2"></Publish>
and this is my InstallScopeDlg code
<?xml version="1.0" encoding="UTF-8"?><!--
Copyright (c) Microsoft Corporation. All rights reserved.-->
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<UI>
<Dialog Id="MyInstallScopeDlg" Width="370" Height="270" Title="!(loc.InstallScopeDlg_Title)" KeepModeless="yes">
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.InstallScopeDlgBannerBitmap)" />
<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="20" Transparent="yes" NoPrefix="yes" Text="!(loc.InstallScopeDlgDescription)" />
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.InstallScopeDlgTitle)" />
<Control Id="BothScopes" Type="RadioButtonGroup" X="20" Y="55" Width="330" Height="120" Property="WixAppFolder" Hidden="yes">
<RadioButtonGroup Property="WixAppFolder">
<RadioButton Value="WixPerUserFolder" X="0" Y="0" Width="295" Height="16" Text="!(loc.InstallScopeDlgPerUser)" />
<RadioButton Value="WixPerMachineFolder" X="0" Y="60" Width="295" Height="16" Text="!(loc.InstallScopeDlgPerMachine)" />
</RadioButtonGroup>
<Condition Action="show">Privileged AND (!(wix.WixUISupportPerUser) AND !(wix.WixUISupportPerMachine))</Condition>
</Control>
<Control Id="PerUserDescription" Type="Text" X="33" Y="70" Width="300" Height="36" Hidden="yes" Text="!(loc.InstallScopeDlgPerUserDescription)">
<Condition Action="show">!(wix.WixUISupportPerUser)</Condition>
</Control>
<Control Id="NoPerUserDescription" Type="Text" X="33" Y="70" Width="300" Height="36" Hidden="yes" Text="!(loc.InstallScopeDlgNoPerUserDescription)">
<Condition Action="show">NOT !(wix.WixUISupportPerUser)</Condition>
</Control>
<Control Id="PerMachineDescription" Type="Text" X="33" Y="131" Width="300" Height="36" Hidden="yes" Text="!(loc.InstallScopeDlgPerMachineDescription)">
<Condition Action="show">Privileged</Condition>
</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)" />
<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>
</Dialog>
</UI>
and for RadioButtonGroup Property="WixAppFolder" in InstallScopeDlg
i have added in product.wxs file
and am getting the error code as
Error 10 The Windows Installer XML variable
!(wix.WixUISupportPerUser) is unknown. Please ensure the variable is
declared on the command line for light.exe, via a WixVariable element,
or inline using the syntax !(wix.WixUISupportPerUser=some value which
doesn't contain parenthesis).
Hence it we need to initially declare its components under the fragment section in your myinstallscopedlg.wxs
<?xml version="1.0" encoding="UTF-8"?><!--
Copyright (c) Microsoft Corporation. All rights reserved.-->
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<WixVariable Id="WixUISupportPerUser" Value="1" Overridable="yes" />
<WixVariable Id="WixUISupportPerMachine" Value="1" Overridable="yes" />
<UI>
<Dialog Id="MyInstallScopeDlg" Width="370" Height="270" Title="!(loc.InstallScopeDlg_Title)" KeepModeless="yes">
by doing this this ERROR The Windows Installer XML variable !(wix.WixUISupportPerUser) is unknown. will be solved