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

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>

Related

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 SetProperty by feature select | Launch specific feature after installation

My WixInstaller is installing two different Apps (Editor AND / OR Viewer).
After the Installation the user can check a checkbox for if he wants to launch the application.
By default, the WixShellExecTargetProperty has the value [#ViewerApp]. If the user has installed the Editor, the Property should have the value [#EditorApp]. But it is not assigned.
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
<SetProperty Id="WixShellExecTarget" Value="[#EditorApp]" After="InstallExecute" Sequence="execute"><![CDATA[EditorFeature=3]]></SetProperty>
<Property Id="WixShellExecTarget" Value="[#ViewerApp]" />
Solution:
Here is my solution that works:
define the CustomAction for each apllication / feature that can/should be started.
<CustomAction Id="SetLaunchApplicationEditor" Property="WixShellExecTarget" Value="[#EditorApp]" />
<CustomAction Id="SetLaunchApplicationViewer" Property="WixShellExecTarget" Value="[#ViewerApp]" />
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
on the last page, where the install is finished, define the start
<Control Id="Finish" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Cancel="yes" Text="[ButtonText_Finish]">
<Publish Event="EndDialog" Value="Return">1</Publish>
<Publish Event="DoAction" Value="SetLaunchApplicationViewer"><![CDATA[&ViewerFeature=3]]></Publish>
<Publish Event="DoAction" Value="SetLaunchApplicationEditor"><![CDATA[&EditorFeature=3]]></Publish>
<Publish Event="DoAction" Value="LaunchApplication">LaunchApp = 1</Publish>
</Control>
!!
If only the Viewer or Editor is installed, then this app is started. If both are installed, the Editor gets started, because it's DoAction is triggered afterwards.
Exit Dialog with the checkbox
<Dialog Id="HtExitDialog" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes">
<Control Id="Finish" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Cancel="yes" Text="[ButtonText_Finish]">
<Publish Event="EndDialog" Value="Return">1</Publish>
<Publish Event="DoAction" Value="SetLaunchApplicationViewer"><![CDATA[&ViewerFeature=3]]></Publish>
<Publish Event="DoAction" Value="SetLaunchApplicationEditor"><![CDATA[&EditorFeature=3]]></Publish>
<Publish Event="DoAction" Value="LaunchApplication">LaunchApp = 1</Publish>
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Disabled="yes" Text="[ButtonText_Cancel]" />
<Control Id="Bitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="234" TabSkip="no" Text="[DialogBitmap]" />
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Disabled="yes" Text="[ButtonText_Back]" />
<Control Id="Description" Type="Text" X="135" Y="70" Width="220" Height="20" Transparent="yes" NoPrefix="yes">
<Text>Click the Finish button to exit the [Wizard].</Text>
</Control>
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<Control Id="Title" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes">
<Text>{\VerdanaBold13}Completing the [ProductName] [Wizard]</Text>
</Control>
<Control Type="CheckBox" Id="StartApp" Width="142" Height="17" X="158" Y="120" Text="Launch Application" Property="LaunchApp" CheckBoxValue="1" />
</Dialog>

Wix Installer - Add custom dialog to WixUI_Minimal

Please note - I don't want to change anything in WixUI_Minimal(if possible).
I am trying to add a custom dialog(UserTypeDlg) after WelcomeEulaDlg in WixUI_Minimal i.e whenever a user clicks on Install button after accepting license. This part works fine
On custom dialog I have provided back button which works just fine and takes me to WelcomeEulaDlg. However, when I again click on Install button it directly start installation with out showing my custom dialog.
Could someone help me to get around this?
My code is -
Custom dialog
-->
<Dialog Id="UserTypeDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
<!--<Control Id="InstallButton" Type="PushButton" Text="Install" Height="17" Width="56" X="245" Y="243">
<Publish Event="EndDialog" Value="Return" />
</Control>-->
<Control Id="UserTypeRadioGroup" Type="RadioButtonGroup" Property="UserTypeRadioButtonGroup" Height="100" Width="100" X="50" Y="50">
<RadioButtonGroup Property="UserTypeRadioButtonGroup">
<RadioButton Value="1" Text="Admin" Height="17" Width="50" X="50" Y="0" />
<RadioButton Value="2" Text="Domain User" Height="17" Width="100" X="50" Y="20" />
</RadioButtonGroup>
</Control>
<!--<Control Id="Next" Type="PushButton" X="245" Y="243" Width="100" Height="17" Text="Next">
<Publish Event="EndDialog" Value="Return" />
</Control>-->
<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" Text="!(loc.WixUIBack)">
<Publish Event="NewDialog" Value="WelcomeEulaDlg">1</Publish>
</Control>
</Dialog>
<!--<Dialog Id="AdminDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="no">
</Dialog>-->
</UI>
</Fragment>
</Wix>
Product installation file:-
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<UI Id="UserTypeUI">
<Property Id="UserTypeRadioButtonGroup" Value="2" />
<!--<TextStyle Id="Tahoma_Regular" FaceName="Tahoma" Size="8" />
<Property Id="DefaultUIFont" Value="Tahoma_Regular"/>-->
<Dialog Id="UserTypeDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
<!--<Control Id="InstallButton" Type="PushButton" Text="Install" Height="17" Width="56" X="245" Y="243">
<Publish Event="EndDialog" Value="Return" />
</Control>-->
<Control Id="UserTypeRadioGroup" Type="RadioButtonGroup" Property="UserTypeRadioButtonGroup" Height="100" Width="100" X="50" Y="50">
<RadioButtonGroup Property="UserTypeRadioButtonGroup">
<RadioButton Value="1" Text="Admin" Height="17" Width="50" X="50" Y="0" />
<RadioButton Value="2" Text="Domain User" Height="17" Width="100" X="50" Y="20" />
</RadioButtonGroup>
</Control>
<!--<Control Id="Next" Type="PushButton" X="245" Y="243" Width="100" Height="17" Text="Next">
<Publish Event="EndDialog" Value="Return" />
</Control>-->
<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" Text="!(loc.WixUIBack)">
<Publish Event="NewDialog" Value="WelcomeEulaDlg">1</Publish>
</Control>
</Dialog>
<!--<Dialog Id="AdminDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="no">
</Dialog>-->
</UI>
</Fragment>
</Wix>
According to the wix documentation you still need to change the '' elements of what you want to change, setting the 'Next Event' and 'Back Event' of your dialog and overwriting the events of elements that should come before and after your dialog

Wix: How to add browse button in 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>