Copy a selected file from command line option or custom dialog to select the file - wix

I am struggling to this with wix. I want to copy a user supplied config file to program data folder. User can either
give file path with msiexec command line parameter
or by selecting the file from open file dialog
Can you give direction to this, please?

If anyone needs, here is my working wxs sample. In command line to set config file use: msiexec /i CONFIGFILE="" /qn
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="SoftwareProject" Language="1033" Version="1.0.0.0" Manufacturer="SomeCompany GmbH" UpgradeCode="18109D29-BA4A-4514-9365-F18850566492">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />
<Property Id="DISABLEADVTSHORTCUTS" Value="1" />
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER"/>
<UIRef Id="WixUI_InstallDir" />
<Property Id="CONFIGFILE" />
<WixVariable Id="WixUILicenseRtf" Value="SomeCompanyLicense.rtf" />
<Condition Message="You need to be an administrator to install this product.">Privileged</Condition>
<Feature Id="ProductFeature" Title="SoftwareProject" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentGroupRef Id="ProgramDataComponents" />
<ComponentRef Id="ApplicationShortcutDesktop" />
</Feature>
<UIRef Id="BrowseForFileDlg"/>
<!--
<InstallUISequence>
<Show Dialog="ConfigDialog" OnExit="success" />
</InstallUISequence>
<InstallExecuteSequence>
<Custom Action="CopyConfigFile" After="CAChooseFile" />
</InstallExecuteSequence>
-->
</Product>
<Fragment>
<Binary Id='ConfigAction_CA' SourceFile="$(var.CustomActionProjectName.TargetDir)\$(var.CustomActionProjectName.TargetName).CA.dll" />
<CustomAction Id='CAChooseFile' BinaryKey='ConfigAction_CA' DllEntry='ChooseConfigFile' Execute="immediate"
Return="check"
Impersonate="no"/>
<UI Id="BrowseForFileDlg">
<Dialog Id="BrowseForFileDlg" Width="370" Height="270" Title="Locate configuration file" 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="Enter the path to the configuration file" />
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="{\WixUI_Font_Title}Locate configuration" />
<Control Id="SourceFileLabel" Type="Text" X="20" Y="60" Width="290" Height="32" NoPrefix="yes" Text="Specify the location of the configuration file"/>
<Control Id="SourceFile" Type="Edit" X="20" Y="94" Width="260" Height="18" Property="CONFIGFILE"/>
<Control Id="BrowseSource" Type="PushButton" X="283" Y="94" Width="18" Height="18" Text="..."/>
<Control Id="Back" Type="PushButton" X="80" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)"/>
<Control Id="UseDefault" Type="PushButton" X="138" Y="243" Width="106" Height="17" Text="Use default configuratoin"/>
<Control Id="Next" Type="PushButton" X="246" 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)"/>
</Dialog>
<Publish Dialog="BrowseForFileDlg" Control="BrowseSource" Event="DoAction" Value="CAChooseFile" Order="1">1</Publish>
<Publish Dialog="BrowseForFileDlg" Control="BrowseSource" Property="CONFIGFILE" Value="[CONFIGFILE]" Order="2">1</Publish>
<Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="BrowseForFileDlg" Order="2">LicenseAccepted="1"</Publish>
<Publish Dialog="BrowseForFileDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
<Publish Dialog="BrowseForFileDlg" Control="Next" Event="EndDialog" Value="Return">1</Publish>
<Publish Dialog="BrowseForFileDlg" Control="Cancel" Event="SpawnDialog" Value="CancelDlg">1</Publish>
<Publish Dialog="BrowseForFileDlg" Control="UseDefault" Property="CONFIGFILE" Order="1">1</Publish>
<Publish Dialog="BrowseForFileDlg" Control="UseDefault" Event="EndDialog" Value="Return" Order="2">1</Publish>
</UI>
</Fragment>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id='SomeCompany' Name='SomeCompany'>
<Directory Id='INSTALLFOLDER' Name='SoftwareProject'>
</Directory>
</Directory>
</Directory>
<Directory Id="CommonAppDataFolder">
<Directory Id='SomeCompanyData' Name='SomeCompany'>
<Directory Id='SoftwareProjectData' Name='SoftwareProject'>
<Directory Id='CONFIGAPPDATAFOLDER' Name='Config' />
</Directory>
</Directory>
</Directory>
<Directory Id="DesktopFolder" Name="Desktop">
<Component Id="ApplicationShortcutDesktop" Guid="{generated guid here}">
<Shortcut Id="ApplicationDesktopShortcut" Name="Launch SoftwareProject" Description="SomeCompany SoftwareProject" Target="[INSTALLFOLDER]SoftwareProject.exe" Arguments="-debug" WorkingDirectory="INSTALLFOLDER"/>
<RemoveFolder Id="DesktopFolder" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software/SoftwareProject" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</Directory>
</Directory>
<ComponentGroup Id="ProgramDataComponents" Directory="CONFIGAPPDATAFOLDER">
<Component Id="ProgramDataDefaultConfigFile" Guid="{generated guid here}">
<Condition>CONFIGFILE=""</Condition>
<File Id="GCC" Name="SoftwareProjectConfig.json" Source="SoftwareProject\Config\SoftwareProjectConfig.json"/>
</Component>
<Component Id="ProgramDataCustomConfigFile" Guid="{generated guid here}">
<Condition>NOT CONFIGFILE=""</Condition>
<CopyFile Id="CopyConfigFile" SourceProperty="CONFIGFILE"
DestinationDirectory="CONFIGAPPDATAFOLDER" DestinationName="SoftwareProjectConfig.json" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>

Related

Display the warning dialog when a condition is satisfied in Wix

In my Wix Installer, I am searching for registry key for Adobe acrobat reader and displaying a warning dialog with "YES" and "NO" option. This dialog is supposed to display during the install sequence immediately after WelcomeDlg enabling user to "continue" or "exit" the installation if Adobe reader is not installed.
I am finding an issue in my code as the "AdobePrerequisiteDlg" does not honors the "ADOBEREADERINSTALLED" property, The dialog is getting displayed even when registry key exist.
The warning dialog "AdobePrerequisiteDlg" should only be displayed when Property "ADOBEREADERINSTALLED" is not satisfied (i.e. registry key does not exist),
But as of now that is not happening as I am able to see the dialog getting displayed everytime.
I tried many changes but not able to figure out where the problem exist. Here is my code :
Product.wxs
<Property Id="ADOBEREADERINSTALLED">
<RegistrySearch Id="ADOBEREADERINSTALLED_REGSEARCH" Key="Software\Microsoft\Windows\CurrentVersion\App Paths\Acrobat.exe" Root="HKLM" Type="raw"/>
</Property>
<UIRef Id="PrerequisiteDialogUI" />
<UI Id="UserInterface">
<DialogRef Id="ProgressDlg" />
<DialogRef Id="ErrorDlg" />
<DialogRef Id="FilesInUse" />
<DialogRef Id="FatalError" />
<DialogRef Id="UserExit" />
<Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="AdobePrerequisiteDlg">1</Publish>
</UI>
Components.wxs
<Fragment>
<UI Id="PrerequisiteDialogUI">
<Dialog Id="AdobePrerequisiteDlg" Width="370" Height="270" Title="Software Requirements Incomplete">
<Control Id="YES" Type="PushButton" X="180" Y="243" Width="56" Height="17" Default="yes" Cancel="yes" Text="YES">
<Publish Event="EndDialog" Value="Return">1</Publish>
</Control>
<Control Id="NO" Type="PushButton" Text="NO" X="236" Y="243" Width="56" Height="17" Cancel="yes" >
<Publish Event="EndDialog" Value="Exit" />
</Control>
<Control Id="Text" Type="Text" X="1" Y="50" Width="340" Height="120" TabSkip="no">
<Text>
The following software requirements have not been met :
Adobe Acrobat Reader
Do you wish to continue ?
</Text>
</Control>
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="Prerequisite for $(var.ProductName) is not installed." />
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="Adobe Reader 9.0" />
<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>
<InstallUISequence>
<Show Dialog="AdobePrerequisiteDlg" Before="ExecuteAction"> <![CDATA[NOT Installed AND ADOBEREADERINSTALLED]]></Show>
</InstallUISequence>
<Fragment>
First of all, you need brackets or double NOT for the condition: NOT (Installed AND ADOBEREADERINSTALLED) OR NOT Installed AND NOT ADOBEREADERINSTALLED
And then. Do you see WelcomeDialog when you start your installer? Or AdobePrerequisiteDlg goes first? If second variant, you need to make some changes in your code. Try this:
Add reference to your custom dialog in your custom UI.
UIRef should point at custom UI, not the UI where custom dialog is described.
In your custom UI describe all variants and steps for dialogs. (see example below)
Condition statement should go inside Publish element.
InstallUISequence is not necessary.
Product.wxs
<Fragment>
<Property Id="ADOBEREADERINSTALLED">
<RegistrySearch Id="ADOBEREADERINSTALLED_REGSEARCH" Key="Software\Microsoft\Windows\CurrentVersion\App Paths\Acrobat.exe" Root="HKLM" Type="raw"/>
</Property>
</Fragment>
<Fragment>
<UIRef Id="UserInterface" />
</Fragment>
<Fragment>
<UI Id="UserInterface">
<DialogRef Id="ProgressDlg" />
<DialogRef Id="ErrorDlg" />
<DialogRef Id="FilesInUse" />
<DialogRef Id="FatalError" />
<DialogRef Id="UserExit" />
<DialogRef Id="AdobePrerequisiteDlg"/>
<Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="AdobePrerequisiteDlg">NOT ADOBEREADERINSTALLED</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="Put_Next_Dialog_Id_Here">ADOBEREADERINSTALLED</Publish>
<Publish Dialog="AdobePrerequisiteDlg" Control="YES" Event="NewDialog" Value="Put_Next_Dialog_Id_Here"/>
<Publish Dialog="AdobePrerequisiteDlg" Control="NO" Event="NewDialog" Value="UserExit"/>
</UI>
</Fragment>
Components.wxs
<Fragment>
<UI Id="PrerequisiteDialogUI">
<Dialog Id="AdobePrerequisiteDlg" Width="370" Height="270" Title="Software Requirements Incomplete">
<Control Id="YES" Type="PushButton" X="180" Y="243" Width="56" Height="17" Default="yes" Cancel="yes" Text="YES"/>
<Control Id="NO" Type="PushButton" Text="NO" X="236" Y="243" Width="56" Height="17" Cancel="yes" />
<Control Id="Text" Type="Text" X="1" Y="50" Width="340" Height="120" TabSkip="no">
<Text>
The following software requirements have not been met :
Adobe Acrobat Reader
Do you wish to continue ?
</Text>
</Control>
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="Prerequisite for $(var.ProductName) is not installed." />
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="Adobe Reader 9.0" />
<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>
</Fragment>

WixInstaller Custom UI template does not change installation path

I am having an issue in creating a custom UI template, the desired flow is:
Licence > InstallScope > install.
I have taken the WIXUI_Advanced source and changed the navigation in the below code, though when changing the selected scope, the installation path is always the default installation.
I think something is in the background happening, though I cannot find how to inject the change, all examples of this are done on the next navigation and loads a new page.
Product.wsx
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Product Id="*" Name="$(var.ProductName)" Language="1033" Version="$(var.ProductVersion)" Manufacturer="$(var.ProductManufacturer)" UpgradeCode="dd862e01-154d-4840-8d90-1dbb91346b6a">
<Package InstallerVersion="200" Compressed="yes" />
<Property Id="ALLUSERS" Value="1" />
<Property Id="MSIINSTALLPERUSER" Value="1" />
<Property Id="REINSTALLMODE" Value="amus" />
<UIRef Id="WixUI_CustomInstaller" />
<Property Id="ApplicationFolderName" Value="$(var.ProductManufacturer)" />
<Property Id="WixAppFolder" Value="WixPerMachineFolder" />
<WixVariable Id="WixUIDialogBmp" Value="$(var.BackgroundImagePath)" />
<WixVariable Id="WixUIBannerBmp" Value="$(var.BannerImagePath)" />
<WixVariable Id="WixUILicenseRtf" Value="$(var.LicencePath)" />
<Icon Id="brandicon.ico" SourceFile="$(var.BrandIconPath)"/>
<Property Id="ARPPRODUCTICON" Value="brandicon.ico" />
<MajorUpgrade Schedule="afterInstallInitialize"
DowngradeErrorMessage="A newer version of [ProductName] is already installed. Setup will now exit."
AllowSameVersionUpgrades="yes"/>
<MediaTemplate EmbedCab="yes" />
<Feature Id="ApplicationFilesFeature" Title="Application Files" Level="1">
<ComponentGroupRef Id="ApplicationFilesComponents"/>
<ComponentRef Id="BrandShortcutComponent"/>
<ComponentRef Id="StartMenuShortcutComponent" />
<ComponentRef Id="DesktopShortcutComponent" />
</Feature>
<!-- Add check box & trigger the custom action if checked -->
<UI>
<UIRef Id="WixUI_CustomInstaller" />
<Publish Dialog="ExitDialog"
Control="Finish"
Event="DoAction"
Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
</UI>
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch application" />
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1"/>
<!-- Custom action for launching application -->
<Property Id="WixShellExecTarget" Value="[INSTALLFOLDER]Application.exe" />
<CustomAction Id="LaunchApplication"
BinaryKey="WixCA"
DllEntry="WixShellExec"
Impersonate="yes" />
</Product>
<Fragment>
<!--Application files in LocalHost-->
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="APPLICATIONFOLDER" Name="$(var.ProductManufacturer)">
<Directory Id="INSTALLFOLDER" Name="$(var.ProductName)">
<Component Id="BrandShortcutComponent" Guid="8867159f-5160-401d-9e23-841c35db54ec">
<Shortcut Id="BrandShortcut"
Name="$(var.ProductName)"
Target="[INSTALLFOLDER]Application.exe"
Icon="brandicon.ico"
WorkingDirectory="INSTALLFOLDER"/>
<RegistryValue Root="HKCU" Key="Software\$(var.ProductName)" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
<util:XmlFile Id='XmlSettings1' File='[INSTALLFOLDER]appSettings.config'
Action='setValue' Value='$(var.AuthorityUri)' Name='value' ElementPath="//appSettings/add[\[]#key='authority.uri'[\]]" Sequence='1' />
<util:XmlFile Id='XmlSettings2' File='[INSTALLFOLDER]appSettings.config'
Action='setValue' Value='$(var.MClientId)' Name='value' ElementPath="//appSettings/add[\[]#key='DocumentWorkflow.ClientID'[\]]" Sequence='2' />
<util:XmlFile Id='XmlSettings3' File='[INSTALLFOLDER]appSettings.config'
Action='setValue' Value='$(var.AClientId)' Name='value' ElementPath="//appSettings/add[\[]#key='FileManagement.ClientID'[\]]" Sequence='3' />
<util:XmlFile Id='XmlSettings4' File='[INSTALLFOLDER]appSettings.config'
Action='setValue' Value='$(var.LClientId)' Name='value' ElementPath="//appSettings/add[\[]#key='Analytics.ClientID'[\]]" Sequence='4' />
</Component>
</Directory>
</Directory>
</Directory>
<!--Start Menu Links-->
<Directory Id="ProgramMenuFolder">
<Component Id="StartMenuShortcutComponent" Guid="e8815935-23dc-497e-85d4-f1c2b7fe7208">
<Shortcut Id="ApplicationStartMenuShortcut"
Name="$(var.ProductName)"
Target="[INSTALLFOLDER]$(var.ProductName).lnk"
Icon="brandicon.ico"
WorkingDirectory="INSTALLFOLDER"/>
<RegistryValue Root="HKCU" Key="Software\$(var.ProductName)" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</Directory>
<!--Desktop Link-->
<!--IMPORTANT: The component ID must place it after the .lnk shortcut creation. This is why it starts with 'ZZZ' -->
<Directory Id="DesktopFolder" Name="Desktop">
<Component Id="DesktopShortcutComponent" Guid="ecb5eebb-a4e0-4218-ad25-d4e77006d8c6">
<Shortcut Id="ZZZApplicationDesktopShortcut"
Name="$(var.ProductName)"
Target="[INSTALLFOLDER]$(var.ProductName).lnk"
Icon="brandicon.ico"
WorkingDirectory="INSTALLFOLDER"/>
<RemoveFile Id="ApplicationDesktopShortcut" Name="$(var.ProductName)" On="uninstall"/>
<RegistryValue Root="HKCU" Key="Software\$(var.ProductName)" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</Directory>
</Directory>
</Fragment>
</Wix>
WixUI_CustomInstaller.wsx
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<WixVariable Id="WixUISupportPerUser" Value="1" Overridable="yes" />
<WixVariable Id="WixUISupportPerMachine" Value="1" Overridable="yes" />
<PropertyRef Id="ApplicationFolderName" />
<CustomAction Id="CusWixSetDefaultPerUserFolder" Property="WixPerUserFolder" Value="[LocalAppDataFolder]Apps\[ApplicationFolderName]" Execute="immediate" />
<CustomAction Id="CusWixSetDefaultPerMachineFolder" Property="WixPerMachineFolder" Value="[ProgramFilesFolder][ApplicationFolderName]" Execute="immediate" />
<CustomAction Id="CusWixSetPerUserFolder" Property="APPLICATIONFOLDER" Value="[WixPerUserFolder]" Execute="immediate" />
<CustomAction Id="CusWixSetPerMachineFolder" Property="APPLICATIONFOLDER" Value="[WixPerMachineFolder]" Execute="immediate" />
<InstallExecuteSequence>
<Custom Action="CusWixSetDefaultPerUserFolder" Before="CostFinalize" />
<Custom Action="CusWixSetDefaultPerMachineFolder" After="CusWixSetDefaultPerUserFolder" />
<Custom Action="CusWixSetPerUserFolder" After="CusWixSetDefaultPerMachineFolder">ACTION="INSTALL" AND APPLICATIONFOLDER="" AND (ALLUSERS="" OR (ALLUSERS=2 AND (NOT Privileged)))</Custom>
<Custom Action="CusWixSetPerMachineFolder" After="CusWixSetPerUserFolder">ACTION="INSTALL" AND APPLICATIONFOLDER="" AND (ALLUSERS=1 OR (ALLUSERS=2 AND Privileged))</Custom>
</InstallExecuteSequence>
<InstallUISequence>
<Custom Action="CusWixSetDefaultPerUserFolder" Before="CostFinalize" />
<Custom Action="CusWixSetDefaultPerMachineFolder" After="CusWixSetDefaultPerUserFolder" />
<Custom Action="CusWixSetPerUserFolder" After="CusWixSetDefaultPerMachineFolder">ACTION="INSTALL" AND APPLICATIONFOLDER="" AND (ALLUSERS="" OR (ALLUSERS=2 AND (NOT Privileged)))</Custom>
<Custom Action="CusWixSetPerMachineFolder" After="CusWixSetPerUserFolder">ACTION="INSTALL" AND APPLICATIONFOLDER="" AND (ALLUSERS=1 OR (ALLUSERS=2 AND Privileged))</Custom>
</InstallUISequence>
<UI Id="WixUI_CustomInstaller">
<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="WelcomeDlg" />
<DialogRef Id="LicenseAgreementDlg"/>
<DialogRef Id="LInstallScopeDlg" />
<!-- Below is the navigation flow we will navigate from top to bottom -->
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
<!-- Fresh install -->
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
<Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="LInstallScopeDlg"></Publish>
<Publish Dialog="LicenseAgreementDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg"></Publish>
<Publish Dialog="LInstallScopeDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
<Publish Dialog="LInstallScopeDlg" Control="Install" Property="ALLUSERS" Value="1" Order="2">1</Publish>
<Publish Dialog="LInstallScopeDlg" Control="Install" Property="APPLICATIONFOLDER" Value="[WixPerMachineFolder]" Order="4">1</Publish>
<Publish Dialog="LInstallScopeDlg" Control="Install" Event="SetTargetPath" Value="WixPerMachineFolder" Order="5">1</Publish>
<Publish Dialog="LInstallScopeDlg" Control="Install" Event="DoAction" Value="WixUIValidatePath" Order="6">NOT WIXUI_DONTVALIDATEPATH</Publish>
<Publish Dialog="LInstallScopeDlg" Control="Install" Event="SpawnDialog" Value="InvalidDirDlg" Order="7"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
<Publish Dialog="LInstallScopeDlg" Control="InstallNoShield" Property="ALLUSERS" Value="{}" Order="1">1</Publish>
<Publish Dialog="LInstallScopeDlg" Control="InstallNoShield" Property="APPLICATIONFOLDER" Value="[WixPerUserFolder]" Order="3">1</Publish>
<Publish Dialog="LInstallScopeDlg" Control="InstallNoShield" Event="SetTargetPath" Value="WixPerUserFolder" Order="8">1</Publish>
<Publish Dialog="LInstallScopeDlg" Control="InstallNoShield" Event="DoAction" Value="WixUIValidatePath" Order="9">NOT WIXUI_DONTVALIDATEPATH</Publish>
<Publish Dialog="LInstallScopeDlg" Control="InstallNoShield" Event="SpawnDialog" Value="InvalidDirDlg" Order="10"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
<Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
<!-- Already Installed -->
<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>
<Fragment>
<UI>
<Dialog Id="LInstallScopeDlg" 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="MyPerUserDescription" Type="Text" X="33" Y="70" Width="300" Height="36" Hidden="yes" NoPrefix="yes" Text="!(loc.InstallScopeDlgPerUserDescription)">
<Condition Action="show">!(wix.WixUISupportPerUser)</Condition>
</Control>
<Control Id="MyNoPerUserDescription" Type="Text" X="33" Y="70" Width="300" Height="36" Hidden="yes" NoPrefix="yes" Text="!(loc.InstallScopeDlgNoPerUserDescription)">
<Condition Action="show">NOT !(wix.WixUISupportPerUser)</Condition>
</Control>
<Control Id="MyPerMachineDescription" Type="Text" X="33" Y="131" Width="300" Height="36" Hidden="yes" NoPrefix="yes" Text="!(loc.InstallScopeDlgPerMachineDescription)">
<Condition Action="show">Privileged</Condition>
</Control>
<Control Id="Back" Type="PushButton" X="150" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" />
<!--<Control Id="Next" Type="PushButton" X="206" Y="243" Width="56" Height="17" Text="!(loc.WixUINext)" />-->
<Control Id="Install" Type="PushButton" ElevationShield="yes" X="206" Y="243" Width="80" Height="17" Hidden="yes" Text="!(loc.FeaturesDlgInstall)">
<Condition Action="show">NOT Installed AND (WixAppFolder = "WixPerMachineFolder")</Condition>
<Condition Action="hide">NOT Installed AND (WixAppFolder = "WixPerUserFolder")</Condition>
<Condition Action="default">NOT Installed</Condition>
<Publish Event="SpawnWaitDialog" Value="WaitForCostingDlg">!(wix.WixUICostingPopupOptOut) OR CostingComplete = 1</Publish>
<Publish Event="EndDialog" Value="Return"><![CDATA[OutOfDiskSpace <> 1]]></Publish>
<Publish Event="SpawnDialog" Value="OutOfRbDiskDlg">OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND (PROMPTROLLBACKCOST="P" OR NOT PROMPTROLLBACKCOST)</Publish>
<Publish Event="EndDialog" Value="Return">OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND PROMPTROLLBACKCOST="D"</Publish>
<Publish Event="EnableRollback" Value="False">OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND PROMPTROLLBACKCOST="D"</Publish>
<Publish Event="SpawnDialog" Value="OutOfDiskDlg">(OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 1) OR (OutOfDiskSpace = 1 AND PROMPTROLLBACKCOST="F")</Publish>
</Control>
<Control Id="InstallNoShield" Type="PushButton" ElevationShield="no" X="206" Y="243" Width="80" Height="17" Hidden="yes" Text="!(loc.FeaturesDlgInstall)">
<Condition Action="show">NOT Installed AND (WixAppFolder = "WixPerUserFolder")</Condition>
<Condition Action="hide">NOT Installed AND (WixAppFolder = "WixPerMachineFolder")</Condition>
<Condition Action="default">NOT Installed</Condition>
<Publish Event="SpawnWaitDialog" Value="WaitForCostingDlg">!(wix.WixUICostingPopupOptOut) OR CostingComplete = 1</Publish>
<Publish Event="EndDialog" Value="Return"><![CDATA[OutOfDiskSpace <> 1]]></Publish>
<Publish Event="SpawnDialog" Value="OutOfRbDiskDlg">OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND (PROMPTROLLBACKCOST="P" OR NOT PROMPTROLLBACKCOST)</Publish>
<Publish Event="EndDialog" Value="Return">OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND PROMPTROLLBACKCOST="D"</Publish>
<Publish Event="EnableRollback" Value="False">OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND PROMPTROLLBACKCOST="D"</Publish>
<Publish Event="SpawnDialog" Value="OutOfDiskDlg">(OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 1) OR (OutOfDiskSpace = 1 AND PROMPTROLLBACKCOST="F")</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>
</Fragment>
</Wix>

Wix: cannot overwrite property in Custom Action

Wix toolset 3.10
Finally I managed to make a simple mock window for installer...But I have failed to overwrite the default value SxSFolder of the property SXS_PATH...
My conception in the install sequence:
After a LicenseAgreementDlg, a customized dialog named WindowsServerRolesAndFeaturesDlg spawns.
In the WindowsServerRolesAndFeaturesDlg, user can browse BrowseDlg to input the explorer path to a path edit TxtDir (id est property SXS_PATH overwritten)
Pushing next button in the customized window, a CustomAction SetCustomActionData to store the property for the deferred CustomAction OfflineSxSInstall.
Finally, in the SetupTypeDlg, install button fires the deferred CustomAction OfflineSxSInstall with the path which user choosing in the BrowseDlg explorer.
But when I saw the custom install, OfflineSxSInstall output the result of SXS_PATH not changed by the BrowseDlg.
What is wrong? I would appreciate any help.
main.wxs
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Name="Hoge 1.12.0" Id="19DF906A-47EE-4B80-ABE8-D1D3F0D89136" UpgradeCode="9357FAA3-91F9-4976-882F-05F4098BBBE8" Language="1041" Codepage="932" Version="1.12.0" Manufacturer="Fuga">
<Package Id="*" Keywords="Installer" Description="Hoge 1.12.0 Installer" Comments="Hoge is register trademark of Fuga company" Manufacturer="Fuga" InstallerVersion="100" Languages="1041" Compressed="yes" SummaryCodepage="932" />
<Property Id="CMD">
<DirectorySearch Id="CmdFolder" Path="[SystemFolder]" Depth="1">
<FileSearch Id="CmdExe" Name="cmd.exe" />
</DirectorySearch>
</Property>
<Media Id="1" Cabinet="Sample.cab" EmbedCab="yes" DiskPrompt="CD-ROM 1" />
<Property Id="DiskPrompt" Value="Fuga Hoge 1.12.0 Installer [1]" />
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
<Property Id="SXS_PATH" Secure="yes" Value="SxSFolder" />
<Property Id="SQLSERVER_INSTANCE_PATH" Secure="yes" Value="SQLServerFolder" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" Name="PFiles">
<Directory Id="Hoge" Name="Hoge">
<Directory Id="INSTALLDIR" Name="Hoge 1.0">
<Component Id="CONFIGURE.BAT" DiskId="1" Guid="041ED78B-3D42-4EBD-8DAE-29D94DEFFC20">
<File KeyPath="yes" Id="file_configure.bat" Name="configure.bat" Source="configure.bat" />
</Component>
</Directory>
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder" Name="Programs">
</Directory>
<Directory Id="SxSFolder" Name="SxS" />
<Directory Id="SQLServerFolder" Name="SQLServer">
</Directory>
<Directory Id="DesktopFolder" Name="Desktop" />
</Directory>
<Feature Id="Complete" Title="Hoge 1.12.0" Description="Perfect Package" Display="expand" Level="1" ConfigurableDirectory="INSTALLDIR">
<Feature Id="MainProgram" Title="Program" Description="Main Program。" Level="1">
<ComponentRef Id="CONFIGURE.BAT" />
</Feature>
</Feature>
<UI Id="MyWixUI_Mondo">
<UIRef Id="WixUI_Mondo" />
<DialogRef Id="WindowsServerRolesAndFeaturesDlg" />
<Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="WindowsServerRolesAndFeaturesDlg" Order="2">
LicenseAccepted = "1"
</Publish>
<Publish Dialog="WindowsServerRolesAndFeaturesDlg" Control="Next" Event="NewDialog" Value="SetupTypeDlg" Order="2">
LicenseAccepted = "1"
</Publish>
<Publish Dialog="WindowsServerRolesAndFeaturesDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg">LicenseAccepted = "1"</Publish>
<Publish Dialog="WindowsServerRolesAndFeaturesDlg" Control="Next" Event="SetTargetPath" Value="[SXS_PATH]" Order="2">1</Publish>
<Publish Dialog="WindowsServerRolesAndFeaturesDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[SXS_PATH]" Order="1">1</Publish>
<Publish Dialog="WindowsServerRolesAndFeaturesDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
</UI>
<UIRef Id="WixUI_ErrorProgressText" />
<InstallExecuteSequence>
<Custom Action="OfflineSxSInstall" After="InstallFiles">NOT Installed</Custom>
</InstallExecuteSequence>
</Product>
</Wix>
WindowsServerRolesAndFeaturesDlg
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<CustomAction Id="SetCustomActionData" Return="check" Property="OfflineSxSInstall" Value="SXS_PATH=[SXS_PATH]" />
<CustomAction Id="OfflineSxSInstall" Property="CMD" Execute="deferred" Return="check" Impersonate="yes" ExeCommand="/c ""[#file_configure.bat]" "[SXS_PATH]""" />
<Property Id="ONOFF_PROPERTY" Secure="yes" Value="0" />
<UI>
<Dialog Id="WindowsServerRolesAndFeaturesDlg" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes">
<Control Id="RdxOnlineOffline" Type="RadioButtonGroup" X="40" Y="63" Width="300" Height="35" Property="ONOFF_PROPERTY" Text="Choose Install Method:">
<RadioButtonGroup Property="ONOFF_PROPERTY">
<RadioButton Value="0" X="0" Y="0" Width="300" Height="15" Text="Available Windows Update" />
<RadioButton Value="1" X="0" Y="20" Width="300" Height="15" Text="Offline Install" />
</RadioButtonGroup>
</Control>
<Control Id="SourcePath" Type="Text" X="45" Y="98" Width="200" Height="15" TabSkip="no" Text="Input SxS source path(&U):" />
<Control Type="PathEdit" Id="TxtDir" X="45" Y="110" Width="220" Height="18" Property="SXS_PATH" Indirect="yes">
<Condition Action="disable"><![CDATA[ONOFF_PROPERTY <> "1"]]></Condition>
<Condition Action="enable"><![CDATA[ONOFF_PROPERTY = "1"]]></Condition>
</Control>
<Control Id="ChangeFolder" Type="PushButton" X="265" Y="110" Width="56" Height="18" Text="Browse...">
<Condition Action="disable"><![CDATA[ONOFF_PROPERTY <> "1"]]></Condition>
<Condition Action="enable"><![CDATA[ONOFF_PROPERTY = "1"]]></Condition>
</Control>
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="Back(&B)">
<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(&N)">
<Publish Event="DoAction" Value="SetCustomActionData">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>Install Windows IIS role and .NET Framework Features</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}Add Windows IIS role and .NET Framework Features</Text>
</Control>
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
</Dialog>
</UI>
</Fragment>
</Wix>
configure.bat content is below:
It copies the hoge.txt to a hoge{%date% without slash}.txt and writes %1 parameter inside. Output result is "SxSFolder"
setlocal
echo on
copy /Y C:\temp\hoge\hoge.txt C:\temp\hoge\hoge%date:~-10,4%%date:~-5,2%%date:~-2,2%.txt
echo %1 > C:\temp\hoge\hoge%date:~-10,4%%date:~-5,2%%date:~-2,2%.txt 2>&1
echo off
endlocal
exit /B 0
P.S.
This is a supplementary information...I failed to understand the meaning of the value "SxSFolder" which is defined in the tag Directory Id="SxSFolder" Name="SxS"...(BrowseDlg PathEdit understands it as "C:\SxS\" as initial value...) I want to set the path (probably contained in the overwritten SxSFolder.Name...) to CustomActionData.... But how to do...?
P.S 2.
I changed CustomActions to set ["directory id"] after reading Reference directory install path in registry value using Wix.... but still batch output result is "C:\SxS\"....(Not Overwritten by BrowseDlg result....)
<CustomAction Id="SetCustomActionData" Return="check" Property="OfflineSxSInstall" Value="SxSFolder=[SxSFolder]" />
<CustomAction Id="OfflineSxSInstall" Property="CMD" Execute="deferred" Return="check" Impersonate="yes" ExeCommand="/c ""[#file_configure.bat]" "[SxSFolder]""" />
P.S 3. msiexec /i {msi} /lv* (Sorry for Japanese Characters....) told me something overwritten the "SxSFolder" property, but result is still not overwritten....
200:アクション 10:39:37: BrowseDlg。Dialog created
201:MSI (c) (B8:7C) [10:39:40:095]: PROPERTY CHANGE: Modifying SxSFolder property. Its current value is 'C:\SxS\'. Its new value: 'C:\'.
202:MSI (c) (B8:7C) [10:39:43:411]: PROPERTY CHANGE: Modifying SxSFolder property. Its current value is 'C:\'. Its new value: 'C:\SxSDummy\'. (<--Overwritten Value)
203:MSI (c) (B8:7C) [10:39:44:259]: Note: 1: 2727 2:
204:MSI (c) (B8:7C) [10:39:45:353]: Doing action: SetCustomActionData
205:アクション 10:39:45: SetCustomActionData。
206:アクション開始 10:39:45: SetCustomActionData。
207:MSI (c) (B8:7C) [10:39:45:353]: PROPERTY CHANGE: Adding OfflineSxSInstall property. Its value is 'SxSFolder=C:\SxSDummy\'.
208:アクション終了 10:39:45: SetCustomActionData。 戻り値 1。
764:Property(C): OfflineSxSInstall = SxSFolder=C:\SxSDummy\
769:Property(C): SxSFolder = C:\SxSDummy\
I uploaded a full verbose log
This is self reply. I removed all underbars and all lowercase characters from property id which set in the custom action.
Below is the wxs files which can overwrite the property by the BrowserDlg...
main.wxs
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Name="Hoge 1.12.0" Id="19DF906A-47EE-4B80-ABE8-D1D3F0D89136" UpgradeCode="9357FAA3-91F9-4976-882F-05F4098BBBE8" Language="1041" Codepage="932" Version="1.12.0" Manufacturer="Fuga">
<Package Id="*" Keywords="Installer" Description="Hoge 1.12.0 Installer" Comments="Hoge is trademark of Fuga Inc." Manufacturer="Fuga" InstallerVersion="100" Languages="1041" Compressed="yes" SummaryCodepage="932" />
<Property Id="CMD">
<DirectorySearch Id="CmdFolder" Path="[SystemFolder]" Depth="1">
<FileSearch Id="CmdExe" Name="cmd.exe" />
</DirectorySearch>
</Property>
<Media Id="1" Cabinet="Sample.cab" EmbedCab="yes" DiskPrompt="CD-ROM 1" />
<Property Id="DiskPrompt" Value="Fuga Hoge 1.12.0 Installer [1]" />
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
<Property Id="SXSPATH" Secure="yes" Value="SXSFOLDER" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" Name="PFiles">
<Directory Id="Hoge" Name="Hoge">
<Directory Id="INSTALLDIR" Name="Hoge 1.0">
<Component Id="CONFIGURE.BAT" DiskId="1" Guid="041ED78B-3D42-4EBD-8DAE-29D94DEFFC20">
<File KeyPath="yes" Id="file_configure.bat" Name="configure.bat" Source="configure.bat" />
</Component>
</Directory>
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder" Name="Programs">
</Directory>
<Directory Id="SXSFOLDER" />
<Directory Id="DesktopFolder" Name="Desktop" />
</Directory>
<Feature Id="Complete" Title="Hoge 1.12.0" Description="Full Package" Display="expand" Level="1" ConfigurableDirectory="INSTALLDIR">
<Feature Id="MainProgram" Title="Program" Description="Main Executable File" Level="1">
<ComponentRef Id="CONFIGURE.BAT" />
</Feature>
</Feature>
<UI Id="MyWixUI_Mondo">
<UIRef Id="WixUI_Mondo" />
<DialogRef Id="WindowsServerRolesAndFeaturesDlg" />
<Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="WindowsServerRolesAndFeaturesDlg" Order="2">
LicenseAccepted = "1"
</Publish>
<Publish Dialog="WindowsServerRolesAndFeaturesDlg" Control="Next" Event="NewDialog" Value="SetupTypeDlg" Order="2">
LicenseAccepted = "1"
</Publish>
<Publish Dialog="WindowsServerRolesAndFeaturesDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg">LicenseAccepted = "1"</Publish>
<Publish Dialog="WindowsServerRolesAndFeaturesDlg" Control="Next" Event="SetTargetPath" Value="[SXSPATH]" Order="2">1</Publish>
<Publish Dialog="WindowsServerRolesAndFeaturesDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[SXSPATH]" Order="1">1</Publish>
<Publish Dialog="WindowsServerRolesAndFeaturesDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
</UI>
<UIRef Id="WixUI_ErrorProgressText" />
<InstallExecuteSequence>
<Custom Action="OfflineSxSInstall" After="InstallFiles">NOT Installed</Custom>
</InstallExecuteSequence>
</Product>
</Wix>
WindowsServerRolesAndFeaturesDlg
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<CustomAction Id="SetCustomActionData" Return="check" Property="OfflineSxSInstall" Value="[SXSFOLDER]" />
<CustomAction Id="OfflineSxSInstall" Property="CMD" Execute="deferred" Return="check" Impersonate="yes" ExeCommand="/c ""[#file_configure.bat]" "[SXSFOLDER]""" />
<Property Id="ONOFF_PROPERTY" Secure="yes" Value="0" />
<UI>
<Dialog Id="WindowsServerRolesAndFeaturesDlg" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes">
<Control Id="RdxOnlineOffline" Type="RadioButtonGroup" X="40" Y="63" Width="300" Height="35" Property="ONOFF_PROPERTY" Text="Select Install Method:">
<RadioButtonGroup Property="ONOFF_PROPERTY">
<RadioButton Value="0" X="0" Y="0" Width="300" Height="15" Text="Available Windows Update" />
<RadioButton Value="1" X="0" Y="20" Width="300" Height="15" Text="Offline Install" />
</RadioButtonGroup>
</Control>
<Control Id="SourcePath" Type="Text" X="45" Y="98" Width="200" Height="15" TabSkip="no" Text="Input if offline and SxS source path available(&U):" />
<Control Type="PathEdit" Id="TxtDir" X="45" Y="110" Width="220" Height="18" Property="SXSPATH" Indirect="yes">
<Condition Action="disable"><![CDATA[ONOFF_PROPERTY <> "1"]]></Condition>
<Condition Action="enable"><![CDATA[ONOFF_PROPERTY = "1"]]></Condition>
</Control>
<Control Id="ChangeFolder" Type="PushButton" X="265" Y="110" Width="56" Height="18" Text="Browse...">
<Condition Action="disable"><![CDATA[ONOFF_PROPERTY <> "1"]]></Condition>
<Condition Action="enable"><![CDATA[ONOFF_PROPERTY = "1"]]></Condition>
</Control>
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="Back(&B)">
<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(&N)">
<Publish Event="DoAction" Value="SetCustomActionData">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>Install IIS role and .NET Framework features.</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}Install IIS role and .NET Framework features</Text>
</Control>
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
</Dialog>
</UI>
</Fragment>
</Wix>

How to create/append the Application folder name at the end of the Target/installation path

I want to create/append the Application folder name at the end of the Target/installation path.
The default path is "C:\CompanyName\"
In this case also it should install in "C:\CompanyName\AppName"
And if the user changes the path to "C:\Test\" (by browse dialog or by typing in the text box), then installation should happen in the "C:\Test\AppName"
I've referred the Wix UI as "WixUI_InstallDir"
I've also Set the Property Id="WIXUI_INSTALLDIR" Value="APPPATH".
And my all shortcuts should point to the final installation path.
Sample snippet code:
Product.wxs
<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<!--- some code here --->
<Property Id="APPPATH" Secure="yes"><![CDATA[C:\CompanyName]]></Property>
<Property Id="WIXUI_INSTALLDIR" Value="APPPATH" />
<Property Id="ALLUSERS">1</Property>
<!--- some code here --->
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='ProgramFilesFolder' Name='PFiles'>
<Directory Id='APPPATH' Name='Product_Title'>
<Directory Id='ConfigurationId' Name='Configuration'>
<!--- some code here --->
</Directory>
</Directory>
</Directory>
</Directory>
<!--- some code here --->
<UI Id="CustomWixUI_Mondo">
<UIRef Id= "AppWixUI_InstallDir" />
<UIRef Id="WixUI_ErrorProgressText" />
</UI>
</Product>
AppWixUI_InstallDir.wxs
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<UI Id="AppWixUI_InstallDir">
<Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
<Property Id="WixUI_Mode" Value="InstallDir" />
<DialogRef Id="BrowseDlg" />
<!-- some more code... .... -->
<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="AppInstallDirDlg" Control="InstallNoShield" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
<Publish Dialog="AppInstallDirDlg" Control="InstallNoShield" Event="DoAction" Value="WixUIValidatePath" Order="2">NOT WIXUI_DONTVALIDATEPATH</Publish>
<Publish Dialog="AppInstallDirDlg" Control="InstallNoShield" Event="SpawnDialog" Value="InvalidDirDlg" Order="3"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
<Publish Dialog="AppInstallDirDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
<Publish Dialog="AppInstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
<!-- some more code... .... -->
</UI>
<UIRef Id="WixUI_Common" />
</Fragment>
AppInstallDirDlg.wxs
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<UI>
<Dialog Id="AppInstallDirDlg" Width="370" NoMinimize = "yes" Height="270" Title="InstallDirDlg_Title">
<Control Id="InstallNoShield" Type="PushButton" ToolTip="Next" ElevationShield="no" X="4" Y="243" Width="80" Height="17" Default="yes" Hidden="yes" Disabled="yes" Text="Next">
<Condition Action="show">NOT Installed </Condition>
<Condition Action="enable">NOT Installed</Condition>
<Condition Action="default">NOT Installed</Condition>
<Publish Event="EndDialog" Value="Return"><![CDATA[OutOfDiskSpace <> 1]]></Publish>
<Publish Event="SpawnDialog" Value="OutOfRbDiskDlg">OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND (PROMPTROLLBACKCOST="P" OR NOT PROMPTROLLBACKCOST)</Publish>
<Publish Event="EndDialog" Value="Return">OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND PROMPTROLLBACKCOST="D"</Publish>
<Publish Event="EnableRollback" Value="False">OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND PROMPTROLLBACKCOST="D"</Publish>
<Publish Event="SpawnDialog" Value="OutOfDiskDlg">(OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 1) OR (OutOfDiskSpace = 1 AND PROMPTROLLBACKCOST="F")</Publish>
</Control>
<!-- <Control Id="Next" Type="PushButton" X="4" Y="243" Width="56" Height="17" ToolTip="Next" Default="yes" Text="Next" /> -->
<Control Id="Back" Type="PushButton" X="246" Y="243" Width="56" Height="17" ToolTip="Back" Text="Back" >
<Publish Event="NewDialog" Value="AppLicenseAgreementDlg">1</Publish>
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" ToolTip="Cancel" Cancel="yes" Text="Cancel">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
<Control Id="FolderLabel" Type="Text" X="20" Y="58" Width="290" Height="15" NoPrefix="yes" Text="InstallDirDlgFolderLabel" />
<Control Id="Folder" Type="PathEdit" X="20" Y="75" Width="320" Height="18" Property="WIXUI_INSTALLDIR" Indirect="yes" />
<Control Id="ChangeFolder" Type="PushButton" X="20" Y="96" Width="80" Height="17" ToolTip="Change Folder" Text="InstallDirDlgChange" />
<Control Id="DiskUsage" Type="Text" X="20" Y="128" Width="290" Height="15" NoPrefix="yes" Text="InstallDirDlgDiskUsage" />
<Control Id="VolumeList" Type="VolumeCostList" X="20" Y="145" Width="320" Height="75" Sunken="yes" Fixed="yes" Remote="yes" Text="DiskCostDlgVolumeList" />
</Dialog>
</UI>
</Fragment>
</Wix>
Any help please...
If you don't need to show the folder MyApp in the dialogs, you can do the following:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="INSTALLFOLDER" Name="CompanyName">
<Directory Id="MyApp" Name="MyApp" />
</Directory>
</Directory>
And in your components replace INSTALLFOLDER with MyApp, this way:
<Component Id="Component_Core" Guid="*" Directory="MyApp">
As a side note, I don't recommend messing up with the dialogs just to show something like "C:\CompanyName\MyApp" or "C:\Temp\MyApp". It is easier if you just show "C:\CompanyName" or "C:\Temp" and install the files to the MyApp folder.
If you still want to show the full text, try something like this (not recommended):
<Property Id="INDIRECT_FOLDER" Value="MyApp" />
<Dialog Id="NewInstallDirDlg" Width="370" Height="270" Title="!(loc.InstallDirDlg_Title)">
<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="!(loc.InstallDirDlgDescription)" />
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.InstallDirDlgTitle)" />
<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" />
<Control Id="FolderLabel" Type="Text" X="20" Y="60" Width="290" Height="30" NoPrefix="yes" Text="!(loc.InstallDirDlgFolderLabel)" />
<Control Id="Folder" Type="PathEdit" X="20" Y="100" Width="320" Height="18" Property="INDIRECT_FOLDER" Indirect="yes" />
<Control Id="ChangeFolder" Type="PushButton" X="20" Y="120" Width="56" Height="17" Text="!(loc.InstallDirDlgChange)" />
</Dialog>

How to set a Property in Wix

I'm confused about the correct procedure for setting a Property in Wix. Is it necessary to use an Event? Are there existing, built-in, events and can they be tailored to custom Wix Properties? What I'm trying to do (with Wix 3.0) is install a IIS Virtual Directory using a custom UI. The problem here is that the property I'm attempting to set the virtual directory name with is not being over-written from the value provided in the interface. The other property here used for the installation path is being over-written and it looks like the Event="SetTargetPath" is what is taking care of that, am I wrong or missing something with this installation UI? Thanks much for your help.
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" Name="PFiles">
<Directory Id="MyCo" Name="MyCo">
<Directory Id="FILEINSTALLDIR" Name="MyCo Admin">
<Component Id="MyCo_AdminComponent" Guid="########-####-####-####-############">
<File Source="Default.aspx" Vital="yes" KeyPath="yes" DiskId="1"/>
</Component>
</Directory>
</Directory>
</Directory>
<Component Id='ADMINVIRTUALDIRCOMP' Guid='########-####-####-####-############' Permanent='no'>
<iis:WebVirtualDir Id='VIRTUALDIRECTORY' Alias='[WIXUI_VIRTUALDIR]' Directory='FILEINSTALLDIR' WebSite='DefaultWebSite'>
<iis:WebApplication Id='ADMINWEBAPPLICATION' Name='[WIXUI_VIRTUALDIR]' />
</iis:WebVirtualDir>
</Component>
</Directory>
<iis:WebSite Id='DefaultWebSite' Description='Default Web Site'>
<iis:WebAddress Id='AllUnassigned' Port='80' />
</iis:WebSite>
<Feature Id="ProductFeature" Title="MyCo WebApp" Level="1">
<ComponentRef Id="MyCo_AdminComponent" />
<ComponentRef Id="ADMINVIRTUALDIRCOMP" />
</Feature>
<UIRef Id="WixUI_Common" />
<UIRef Id="WixUI_InstallWeb" />
<Property Id="WIXUI_INSTALLDIR" Value="FILEINSTALLDIR" />
<Property Id="WIXUI_VIRTUALDIR" Value ="VIRTUALDIR" ></Property>
<Property Id="VIRTUALDIR" ><![CDATA[AdminCompName]]></Property>
<UI Id="WixUI_InstallWeb">
<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="InstallDir" />
<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="InstallWebDlg">1</Publish>
<Publish Dialog="InstallWebDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
<Publish Dialog="InstallWebDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
<Publish Dialog="InstallWebDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath" Order="2">
NOT WIXUI_DONTVALIDATEPATH</Publish>
<Publish Dialog="InstallWebDlg" Control="Next" Event="SpawnDialog" Value="InvalidDirDlg" Order="3">
<![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
<Publish Dialog="InstallWebDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="4">
WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID="1"</Publish>
<Publish Dialog="InstallWebDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
<Publish Dialog="InstallWebDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="InstallWebDlg" Order="1">NOT Installed</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed</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" />
<Dialog Id="InstallWebDlg" Width="370" Height="270" Title="!(loc.InstallDirDlg_Title)">
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)" >
</Control>
<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="!(loc.InstallDirDlgDescription)" />
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.InstallDirDlgTitle)" />
<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" />
<Control Id="FolderLabel" Type="Text" X="20" Y="60" Width="290" Height="30" NoPrefix="yes" Text="!(loc.InstallDirDlgFolderLabel)" />
<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)" />
<Control Id="VirtualDirLabel" Type="Text" X="20" Y="160" Width="290" Height="10" NoPrefix="yes" Text="Virtual Directory:" />
<Control Id="VirtualDir" Type="Edit" X="20" Y="172" Width="320" Height="18" Property="WIXUI_VIRTUALDIR" Indirect="yes" />
</Dialog>
</UI>
Is it necessary to use an Event? Are there existing, built-in, events and can they be tailored to custom Wix Properties?
No, it is not necessary to use an Event to set property values; they can be set explicitly, via custom actions, or from conditions. To answer the second question, no, there isn't an event model which you can tailor to custom properties within Wix.
I can't help but wonder if your problem of the virtual directory name not being set has to do with your VIRTUALDIR property not having the Secure attribute. Take a look at this model. I'm not certain, but I think only secure properties can move from the client (pink) area to the server (green) area.
Perhaps try adding Secure="yes" to the property and see if that does the trick?