How to Use RadioButtonGroup Control with Indirect Property? - wix

I am working on a installer using WIX Toolset which have a dialog, which takes a few inputs from user and pass them to parent dialog. For POC I did that for Edit Control that worked perfectly.
But when I tried same using RadioButtonGroup It fails with
Unresolved reference to symbol 'Property:_TestRb' in section 'Fragment:'.(LGHT0094)
below is my parent dialog
<?xml version="1.0"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<UI>
<DialogRef Id="spandlg"></DialogRef>
<Property Id="TestProp" Value="Test"></Property>
<Property Id="TestRadio" Value="1"></Property>
<Dialog Id="parent_dlg" Width="370" Height="270" Title="parent.dlg">
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="Next">
<Publish Property="_TestRb" Value="TestRadio" Order="2">1</Publish>
<Publish Property="_TestP" Value="TestProp" Order="1">1</Publish>
<Publish Event="SpawnDialog" Value="spandlg" Order="3">1</Publish>
</Control>
<Control Id="txtBox" Type="Edit" Height="15" Width="321" X="10" Y="16" Property="TestRadio"></Control>
<Control Id="txtBox1" Type="Edit" Height="15" Width="321" X="10" Y="50" Property="TestProp"></Control>
<Control Id="c" Type="PushButton" X="300" Y="243" Width="56" Height="17" Default="yes" Text="Cancel">
<Publish Event="EndDialog" Value="Exit" Order="2">1</Publish>
</Control>
</Dialog>
</UI>
</Fragment>
</Wix>
and this is dialog to be opened as Spawn
<?xml version="1.0"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<UI>
<Dialog Id="spandlg" Width="370" Height="270" Title="spandlg">
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="[Button_Next]">
<Publish Event="EndDialog" Value="Return"></Publish>
</Control>
<Control Id="textBox1" Type="Edit" Height="15" Width="176" X="9" Y="9" Property="_TestP" Indirect="yes" />
<Control Id="radioButtonGroupBox1" Type="RadioButtonGroup" Height="75" Width="150" X="10" Y="36"
Property="_TestRb" Indirect="yes" >
<RadioButtonGroup Property="_TestRb">
<RadioButton X="3" Y="26" Height="18" Width="78" Text="radioButton2" Value="0" />
<RadioButton X="3" Y="3" Height="18" Width="78" Text="radioButton1" Value="1" />
</RadioButtonGroup>
</Control>
</Dialog>
</UI>
</Fragment>
</Wix>
I can't get what's wrong with code.

You should define the property somewhere. Something like
<Property Id="_TestRb" />
Maybe you swapped Property and Value attributes?

I was able to solve the Issue after removing,
<Control Id="txtBox" Type="Edit" Height="15" Width="321" X="10" Y="16" Property="TestRadio"></Control>
from parent_dlg dialog.
It looks like, as Edit Control can change value of property TestRadio other then 0 and 1 which are invalid according to ICE34. But Error Message Unresolved reference to symbol 'Property:_TestRb' in section 'Fragment:' was not at all helpful.
After defining Property _TestRb actual error was shown ICE34: 1 is not a valid default value for the property TestRadio. The property is an indirect RadioButtonGroup property of control spandlg.radioButtonGroupBox1 (via property _TestRb). (LGHT0204).

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 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 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>

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>

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