Conditional Feature based on Property - wix

In my bundle I have 2 features which both are about creating a folder structure based on the value of a property. As you can see my conditions are fairly simple. What is interesting is that only the condition on feature ONE works, while in feature TWO (where it does a comparison) it does nothing, but If I add the condition on every component I need just like in the other pasted code it works fine.
I was wondering why this is happening
<Property Id="NUMBER" />
<Feature Id="ONE" Level="0">
<Condition Level="1">
<![CDATA[NOT NUMBER]]>
</Condition>
<ComponentGroupRef Id="OneStructure"/>
</Feature>
<Feature Id="TWO" Level="0">
<Condition Level="1">
<![CDATA[NUMBER <> ""]]>
</Condition>
<ComponentGroupRef Id="OneStructure"/>
</Feature>
-
<Directory Id="dir77996843FCCE5E3734A5EDAA86FCE55B" Name="Input">
<Component Id="cmp2F4C23D858A887EF0B2539F7EC1884BE" Guid="{625D2714-157F-4B21-86C0-D4954A4E1F73}" KeyPath="yes"> <Condition> <![CDATA[NUMBER <> ""]]> </Condition>
<CreateFolder />
</Component>
</Directory>

Had the same issue. Apparently it has to do with the condition only being evaluated once.
Instead of putting a condition directly in a feature, you can put conditions in a Control Event pertaining to a button in a given dialog.
Example:
<Control Id="Install" Type="PushButton" X="304" Y="243" Width="56" Height="17" Default="yes" Text="Install">
<!--Check property value here:-->
<Publish Event="AddLocal" Value="ALL">1</Publish>
<Publish Event="Remove" Value="ONE">NUMBER = 0</Publish>
<Publish Event="Remove" Value="TWO">NUMBER = 1</Publish>
<Publish Event="EndDialog" Value="Return" />
</Control>
You would then change the value of the property "NUMBER" with a Radio Button.
Hope this helps!

Related

Set property in custom dialog for conditional feature

I have a property called SELECTEDFEATURESET with a default value of 'none'. In a custom dialog I'm trying to set this property, according to which button the user pressed. At the end I use the property to decide if certain components shall be installed or not.
Propery defined in the main installer file (Product.wxs):
<Property Id='SELECTEDFEATURESET' Value='none' />
Set the property in the dialog:
<Control Id="InternalFeatureButton" Type="PushButton" Text="FeatureSetA">
<Publish Event="NewDialog" Value="InstallDirDlg">1</Publish>
<Publish Property="SELECTEDFEATURESET" Value="FeatureSetA">1</Publish>
</Control>
<Control Id="ProductionFeatureButton" Type="PushButton" Text="FeatureSetB">
<Publish Event="NewDialog" Value="InstallDirDlg">1</Publish>
<Publish Property="SELECTEDFEATURESET" Value="FeatureSetB">1</Publish>
</Control>
<Control Id="DemoFeatureButton" Type="PushButton" Text="FeatureSetC">
<Publish Event="NewDialog" Value="InstallDirDlg">1</Publish>
<Publish Property="SELECTEDFEATURESET" Value="FeatureSetC">1</Publish>
</Control>
Decide whether the feature shall be installed or not:
<Feature Id='ParentFeature' Level='0'>
<ComponentRef Id='ComponentA' />
<Condition Level='1'><![CDATA[SELECTEDFEATURESET="FeatureSetA"]]></Condition>
</Feature>
<Feature Id='ParentFeature' Level='0'>
<ComponentRef Id='ComponentB' />
<Condition Level='1'><![CDATA[SELECTEDFEATURESET="FeatureSetB"]]></Condition>
</Feature>
<Feature Id='ParentFeature' Level='0'>
<ComponentRef Id='ComponentC' />
<Condition Level='1'><![CDATA[SELECTEDFEATURESET="FeatureSetC"]]></Condition>
</Feature>
When I run the installer and press the FeatureSetA button, no optional component is installed. When I initialize the SELECTEDFEATURESET property with 'FeatureSetA', then the ComponentA is installed (same for A, B and C).
Why is the value of SELECTEDFEATURESET 'none' instead of 'FeatureSetA' / 'FeatureSetB' / 'FeatureSetC' at the time of the feature condition evaluation?
How do I fix it?
I fixed it my moving the condition from the feature to the component.

How can I execute a custom action in wix just before service installation?

This my Product.wxs:
In the custom action, I want to make changes in the httpd.conf file before Apache 2.4 service is installed, actually the Apache 2.4 Service takes Configuration parameters from httpd.conf, so its mandatory for the code that the changes should be made before installation of service, If any idea help me on this ?
<?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="MyExampleProject" Language="1033" Version="1.0.0.0" Manufacturer="Mq" UpgradeCode="08bd3c48-deef-4370-ab94-f8b4d49406e3">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" InstallPrivileges="elevated"/>
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<!--System Configuration Condition - Installation install only above Windows XP-->
<Condition Message="This application is only supported on Windows XP, or higher.">
<![CDATA[Installed OR (VersionNT >= 501)]]>
</Condition>
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='ProgramFilesFolder' Name='PFiles'>
<Directory Id='INSTALLDIR' Name='AgentFramework'>
<Directory Id='INSTALLBIN' Name='bin'/>
<Directory Id='INSTALLCONF' Name='conf'/>
<Directory Id='INSTALLMODULES' Name='modules'/>
</Directory>
</Directory>
</Directory>
<Feature
Id = "ProductFeature1"
Title = "AgentFramework"
Level = "1"
Absent="allow">
<ComponentRef Id='libapr_dll'/>
<ComponentRef Id='libapriconv_dll'/>
<ComponentRef Id='libaprutil_dll'/>
<ComponentRef Id='libhttpd_dll'/>
<ComponentRef Id='Pcre_dll'/>
<ComponentRef Id='Configurationfile'/>
<ComponentRef Id='Authzmodule'/>
<ComponentRef Id='Dirmodule'/>
<ComponentRef Id='ServiceComponent'/>
</Feature>
<DirectoryRef Id='INSTALLCONF'>
<Component Id='Configurationfile' Guid='2E0D2957-10EB-463A-A4FC-62B9062FE8A3'>
<File Id='Configurationfile' Name='httpd.conf' DiskId='1' Source='$(sys.CURRENTDIR)\httpd.conf' KeyPath='yes'>
</File>
</Component>
</DirectoryRef>
<DirectoryRef Id='INSTALLMODULES'>
<Component Id='Authzmodule' Guid='62AA97B6-7821-4CB4-9F89-B2A8FF0CC6BD'>
<File Id='Authzmodule' Name='mod_authz_core.so' DiskId='1' Source='$(sys.CURRENTDIR)\mod_authz_core.so' KeyPath='yes'>
</File>
</Component>
<Component Id='Dirmodule' Guid='9966BB3B-8296-43B9-A6DC-712561303329'>
<File Id='Dirmodule' Name='mod_dir.so' DiskId='1' Source='$(sys.CURRENTDIR)\mod_dir.so' KeyPath='yes'>
</File>
</Component>
</DirectoryRef>
<DirectoryRef Id='INSTALLBIN'>
<Component Id='libapr_dll' Guid='FB82D093-0B32-465B-8D8B-08B3127EB414'>
<File Id='libapr_dll' Name='libapr-1.dll' DiskId='1' Source='$(sys.CURRENTDIR)\libapr-1.dll' KeyPath='yes'>
</File>
</Component>
<Component Id='libapriconv_dll' Guid='667D6D5B-6FE4-4A6B-827F-C496239628E2'>
<File Id='libapriconv_dll' Name='libapriconv-1.dll' DiskId='1' Source='$(sys.CURRENTDIR)\libapriconv-1.dll' KeyPath='yes'>
</File>
</Component>
<Component Id='libaprutil_dll' Guid='72C688D2-8E25-49D9-9E76-F6BDBC33D394'>
<File Id='libaprutil_dll' Name='libaprutil-1.dll' DiskId='1' Source='$(sys.CURRENTDIR)\libaprutil-1.dll' KeyPath='yes'>
</File>
</Component>
<Component Id='libhttpd_dll' Guid='8946D5B1-0EA2-443E-8C20-CD8D877ACF75'>
<File Id='libhttpd_dll' Name='libhttpd.dll' DiskId='1' Source='$(sys.CURRENTDIR)\libhttpd.dll' KeyPath='yes'>
</File>
</Component>
<Component Id='Pcre_dll' Guid='0466BB2A-137C-4A95-A510-43E7A274F834'>
<File Id='Pcre_dll' Name='pcre.dll' DiskId='1' Source='$(sys.CURRENTDIR)\pcre.dll' KeyPath='yes'>
</File>
</Component>
<Component Id ="ServiceComponent" Guid="8A1BF3F0-8A84-456E-816A-5907B40B2DDB" >
<File Id='Applicationfile' Name='httpd.exe' DiskId='1' Source='$(sys.CURRENTDIR)\httpd.exe' KeyPath='yes'>
</File>
<ServiceInstall Id="ServiceComponent" Type="ownProcess" Name="Apache2.4"
DisplayName="Apache2.4" Description="Service"
Arguments="-k runservice" Start="auto" Account="LocalSystem" ErrorControl="normal"
Vital="yes" >
<util:PermissionEx User="Everyone" ServicePauseContinue="yes" ServiceQueryStatus="yes"
ServiceStart="yes" ServiceStop="yes" ServiceUserDefinedControl="yes" /> </ServiceInstall>
<ServiceControl Id="ServiceComponent" Start="install" Stop="both"
Remove="uninstall" Name="Apache2.4" Wait="yes" />
</Component>
</DirectoryRef>
<UIRef Id="CustomizeDlg" />
<UI Id="MyWixUI_Mondo">
<UIRef Id="WixUI_Mondo" />
<UIRef Id="WixUI_ErrorProgressText" />
<DialogRef Id="UserRegistrationDlg" />
<Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="UserRegistrationDlg" Order="3">LicenseAccepted = "1"</Publish>
<Publish Dialog="SetupTypeDlg" Control="Back" Event="NewDialog" Value="UserRegistrationDlg">1</Publish>
</UI>
<Property Id="PIDTemplate"><![CDATA[1234<####-####-####-####>####]]></Property>
<CustomAction Id='CheckLogLevel' BinaryKey='CheckLogLevel' DllEntry='CustomAction1' />
<Binary Id ='CheckLogLevel' SourceFile='$(sys.CURRENTDIR)\MqAgent_LogLevel.dll'/>
<WixVariable Id="WixUIBannerBmp" Value="C:\Image\style39_banner.bmp" />
<WixVariable Id="WixUIDialogBmp" Value="C:\Image\style39_dialog.bmp" />
</Product>
</Wix>
Here's CustomizeDlg.wxs :
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<UI Id ="CustomizeDlg">
<ComboBox Property="SETUPLOGLEVEL">
<ListItem Text="Debug" Value="1" />
<ListItem Text="info" Value="2" />
<ListItem Text="warn" Value="3" />
</ComboBox>
<Dialog Id="UserRegistrationDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
<Control Id="NameEdit" Type="ComboBox" X="52" Y="48" Width="156" Height="10" ComboList="yes"
Property="SETUPLOGLEVEL" Sorted="no" RightToLeft="yes"/>
<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]" />
<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="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 mention the log level</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}Select Log Level</Text>
</Control>
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
</Dialog>
</UI>
</Fragment>
</Wix>
What I've done before was put all my custom action's logic in an executable and then call the executable, which worked nicely. It turns out that WiX provides various Custom Action Projects within Visual Studio that remove the need to create a stand alone executable, see here for a nice example by James Schaffer.
As for controlling when the custom action is executed, you control this by adding an entry in the InstallExecuteSequence node of the *.wxs file, like this...
<InstallExecuteSequence>
<Custom Action="CheckLogLevel" Before="InstallServices" />
</InstallExecuteSequence>
... where CheckLogLevel is my custom action, and it's being directed to be run before the InstallServices action.
mattyB gets a big thumbs up.
To better understand this problem though I think it's important to view the MSI in Orca. Orca is a MS product which can view the lifecycle of MSI files. It also allows you to directly edit the MSI file.
Below is a screenshot of the "jobs" which will be run by the installer in sequence order. mattyB mentioned the "InstallServices" job, which I have highlighted in the screenshot below. We need to make sure all of our custom actions occur BEFORE this job runs. From here it's as simple as setting the "Before" attribute in the "Custom" tag to a value of "InstallServices."
Hopefully this helps to further demystify WiX.

Override Publish within UIRef in WiX

I have an UI library with this code:
<Fragment>
<UI Id="My_UI">
<Dialog Id="Dialog_A">
<Control Id="Button_Next" Type="PushButton" Text="Next">
<Publish ... />
</Control>
</Dialog>
</UI>
</Fragment>
And then I have my main project with a reference to this library.
<Product>
<UIRef Id="My_UI" />
</Product>
The problem is that I cannot add a new Publish event. I tried to do this, but then it doesn't work at all.
<Product>
<UI Id="My_UI">
<DialogRef Id="Dialog_A" />
<Publish Dialog="Dialog_A" Control="Button_Next"
Event="DoAction" Value="GenInstallReview">1</Publish>
</UI>
</Product>
How can I extend the dialog with a new Publish in the main application?
You can add control events but you cannot override existing ones. Open your .msi with Orca and inspect the ControlEvent table rows for Dialog_A. When you have multiple rows for the same dialog/button combination, you have to follow the rules specified here.

How to pass the Parameters to custom action method in wix

I am new to create MSI installer using wix tool,here i have a query please help me how to resolve this .
My query is : I have create a custom UI , in this i have a combo box control and i have bind the combo box values as dynamically using custom Action method it's working fine . Now, i want pass the parameters(combo box selected value) to custom action method,i don't know how to pass parameters .I goggled but i did not get answer please help me.
Here is my code
<Binary Id="CustomActions" SourceFile="D:\WIX Projects\ExampleSetup\CustomAction1\bin\Debug\CustomAction1.CA.dll" />
<CustomAction Id='Action1' BinaryKey='CustomActions' DllEntry='FillServerInstances' Execute='immediate' Return='check' />
<UI>
<Dialog Id="CustomWelcomeEulaDlg" Width="600" Height="450" Title="!(loc.WelcomeEulaDlg_Title)">
<Control Id="Bitmap" Type="Bitmap" X="0" Y="44" Width="600" Height="380" TabSkip="no" Text="MainImage" />
<Control Id="Next" Type="PushButton" X="290" Y="430" Width="60" Height="17" Default="yes" Text="Next">
<Publish Event="DoAction" Value="Action1">1</Publish>
<Publish Event="NewDialog" Value="LicenseAgreementDlgs"><![CDATA[1]]></Publish>
<Publish Event="ReinstallMode" Value="ecmus"><![CDATA[Installed = 1]]></Publish>
</Control>
<Control Id="Cancel" Type="PushButton" X="350" Y="430" Width="56" Height="17" Cancel="yes" Text="Cancel">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
<Control Id="Title" Type="Text" X="15" Y="6" Width="300" Height="15" Transparent="yes" NoPrefix="yes">
<Text>[DlgTitleFont]Welcome to the [ProductName] [Wizard]</Text>
</Control>
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="600" Height="0" />
</Dialog>
Latest Code
<Product Id="22d32870-651b-4eee-a622-27b2daaade8c" Name="Small Business" Language="1033" Version="1.0.0.0" Manufacturer="Small Business Manufacturing" UpgradeCode="01b2dc2f-61f3-4ff0-a0ba-94dd4cb0829d">
<Package InstallerVersion="200" Compressed="yes" />
<Property Id="MSIFASTINSTALL" Value="3" />
<Binary Id="BIN_CustomAction" SourceFile="D:\WIX Projects\ExampleSetup\CustomAction1\bin\Debug\CustomAction1.CA.dll"/>
<Binary Id="myAction" SourceFile="D:\WIX Projects\ExampleSetup\CustomAction1\bin\Debug\CustomAction1.CA.dll"/>
<UIRef Id="WixUI_CustomMinimal" />
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
<Property Id="FILEPATH" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLLOCATION" Name="Small Business Manufacturing">
<Component Id="Component" Guid="af10d5b4-5d25-474f-8360-13b6c0cd7a53">
<File Id="Component" Source="D:\WIX Projects\Small Business Manufacturing\Small Business Manufacturing\bin\Debug\Myproject.exe" Compressed="yes" KeyPath="yes" Checksum="yes" />
</Component>
</Directory>
</Directory>
</Directory>
<Feature Id="ProductFeature" Title="Installation Target" Level="1">
<ComponentRef Id="Component" />
</Feature>
<InstallExecuteSequence>
<Custom Action="myActionId" After="InstallFinalize"></Custom>
</InstallExecuteSequence>
<CustomAction Id="SetCustomActionDataValue" Return="check" Property="myActionId" Value="AnotherValue=[Sqlinstaces]" />
<UI>
<ProgressText Action="RunEXE">Configuring Foo... (this may take a few minutes).</ProgressText>
</UI>
</Product>
As far as I am aware you can't pass parameters to custom actions. You can set a property in Wix and use WcaGetProperty to access that.
I use a listbox which is similar like so:
<!--This will be populated via the custom action-->
<Control Id="ListBoxID" Type="ListBox" Property="COMPORT" Width="80" Height="40" X="80" Y="165" Indirect="no">
<ListBox Property="COMPORT">
</ListBox>
</Control>
And in my C++ Custom Action:
hr = WcaGetFormattedProperty(L"COMPORT",&szComport);
ExitOnFailure(hr, "failed to get Com Port");
EDIT:
Ok so I am assuming your ComboBox is something like this:
<Control Id="DummyComboBox" Hidden="yes" Type="ComboBox" Sorted="yes" ComboList="yes" Property="DUMMYPROPERTY" X="65" Y="60" Width="150" Height="18">
<ComboBox Property="DUMMYPROPERTY">
</ComboBox>
Make sure your property is is defined like so(ensure capital letters):
<Property Id="DUMMYPROPERTY" Secure="yes"></Property>
You do not need a custom action to send the value of the property. All you have to do is use:
LPWSTR dummyText = NULL;
hr = WcaGetProperty(L"DUMMYPROPERTY", &dummyText);
ExitOnFailure(hr, "failed to get Dummy Text");
That is for a C++ Custom Action not sure what you are using but a quick google search would tell you the relevant code to use.

WiX Error LGHT0130 In InstallScopeDlg when modifying Wix_Advanced UI

I am using WiX 3.6.
I am using the WIX_Advanced user interface and I want to replace the InstallScopeDlg with my own version (called InstallScopeDlgDsktp) which includes a checkbox for adding a Desktop shortcut.
When I do this, I take all the references to the old InstallScopeDlg in the WixUI_Advanced.wxs file, and override them in my main file to instead reference my custom InstallScopeDlgDsktp module.
However, when I try compiling, I get an error which seems to indicate there is a clash with a RadioButton table which means both my InstallScopeDlgDsktp and the original InstallScopeDlg must be adding a RadioButton based on the same property (WixAppFolder).
light Cryptobot.wixobj InstallScopeDlgDsktp.wixobj -ext WixUIExtension -out Cryptobot.msi
Microsoft (R) Windows Installer Xml Linker version 3.6.2221.0
<snip>wixlib\InstallScopeDlg.wxs(24): error LGHT0130 :
The primary key 'WixAppFolder/1' is duplicated in table 'RadioButton'. Please remove one of the entries or rename a part of the primary key to avoid the collision.
I can't seem to get around this. My question is, why is it even linking in the original InstallScopeDlg module when I am not even referencing it any more? How do I stop the original InstallScopeDlg from adding the RadioButton?
Code provided for reference:
Main WXS file (UI stuff is at the bottom - can see I replaced all instances of InstallScopeDlg with InstallScopeDlgDsktp):
<?xml version="1.0" encoding="windows-1252"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<!-- Defines -->
<?define ProductName="Cryptobot" ?>
<?define ProductVersion="1.1.1" ?>
<Product Name="$(var.ProductName) $(var.ProductVersion)" Id="*"
UpgradeCode="MY-UPGRADE-GUID"
Language="1033" Codepage="1252" Version="$(var.ProductVersion)" Manufacturer="Crafted From Code">
<!-- The Package GUID must be changed EVERY timeyou build a new .msi. The asterisk makes this happen automatically. -->
<Package Id="*" Keywords="Installer"
Description="$(var.ProductName) $(var.ProductVersion) Setup"
Manufacturer="Crafted From Code"
InstallerVersion="200" Languages="1033" Compressed="yes" />
<Media Id="1" Cabinet="$(var.ProductName).cab" EmbedCab="yes" />
<!-- Components to install -->
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="CraftedFromCode" Name="Crafted From Code">
<Directory Id="APPLICATIONFOLDER" Name="$(var.ProductName)">
<Component Id="MainExecutable" Guid="MY-GUID">
<File Id="CryptobotEXE" Name="Cryptobot.exe" Source="..\Cryptobot\bin\Release\Cryptobot.exe" KeyPath="yes">
<Shortcut Id="CryptobotProgramMenuShortcut" Directory="ProgramMenuDir"
Name="$(var.ProductName)" Icon="Cryptobot.ico" IconIndex="0" Advertise="yes" />
<Shortcut Id="CryptobotDesktopShortcut" Directory="DesktopFolder"
Name="$(var.ProductName)" Icon="Cryptobot.ico" IconIndex="0" Advertise="yes" />
</File>
<RemoveFolder Id="APPLICATIONFOLDER" On="uninstall" />
</Component>
</Directory>
</Directory>
</Directory>
<!-- Start Menu Shortcut(s) -->
<Directory Id="ProgramMenuFolder" Name="Programs">
<Directory Id="ProgramMenuDir" Name="$(var.ProductName)">
<Component Id="ProgramMenuShortcut" Guid="MY-GUID" >
<RegistryValue Root="HKCU" Key="Software\Crafted From Code\Cryptobot" Name="installed" Type="integer" Value="1" KeyPath="yes" />
<RemoveFolder Id="ProgramMenuDir" On="uninstall" />
</Component>
</Directory>
</Directory>
<!-- Desktop Shortcut -->
<Directory Id="DesktopFolder">
<Component Id="DesktopShortcut" Guid="MY-GUID">
<Condition>INSTALLDESKTOPSHORTCUT</Condition>
<RegistryValue Root="HKCU" Key="Software\Crafted From Code\Cryptobot" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
</Directory>
</Directory> <!-- End of TARGETDIR root directory -->
<Icon Id="Cryptobot.ico" SourceFile="Cryptobot.ico" />
<Feature Id="Complete" Level="1" Title="$(var.ProductName)"
Description="The complete package." Display="expand"
ConfigurableDirectory="APPLICATIONFOLDER">
<ComponentRef Id="MainExecutable" />
<ComponentRef Id="ProgramMenuShortcut" />
<ComponentRef Id="DesktopShortcut" />
</Feature>
<!-- Upgrade rules: If a newer version is found, don't allow installation of an older version (downgrading).
Otherwise, if an older version is already installed, remove it before installing the current version -->
<Upgrade Id="MY-UPGRADE-GUID">
<UpgradeVersion OnlyDetect="yes" Property="NEWERPRODUCTFOUND" Minimum="$(var.ProductVersion)" IncludeMinimum="no" />
<!-- Setting IncludeMaximum to yes generates a linker warning, but it means that we can install over the
same version without necessarily having to change the version number. -->
<UpgradeVersion OnlyDetect="no" Property="PREVIOUSVERSIONINSTALLED" Minimum="1.0.0" IncludeMinimum="yes" Maximum="$(var.ProductVersion)" IncludeMaximum="yes" />
</Upgrade>
<CustomAction Id='PreventDowngrading' Error='A newer version of $(var.ProductName) is already installed.' />
<InstallExecuteSequence>
<Custom Action='PreventDowngrading' After='FindRelatedProducts'>NEWERPRODUCTFOUND</Custom>
<RemoveExistingProducts After="InstallFinalize" />
</InstallExecuteSequence>
<InstallUISequence>
<Custom Action='PreventDowngrading' After='FindRelatedProducts'>NEWERPRODUCTFOUND</Custom>
</InstallUISequence>
<!-- User Interface: Use the Advanced WiX interface, which will allow 1-click installation or
per user/per machine installation & install directory to be specified -->
<UIRef Id="WixUI_Advanced" />
<UIRef Id="WixUI_ErrorProgressText" />
<Property Id="ApplicationFolderName" Value="Crafted From Code\Cryptobot" />
<Property Id="WixAppFolder" Value="WixPerUserFolder" /> <!-- Defaults to install for all users -->
<Property Id="INSTALLDESKTOPSHORTCUT" Value="1" /> <!-- Support for a desktop shortcut -->
<!-- Add a checkbox to launch the application when the installer exits -->
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch $(var.ProductName) when setup exits." />
<!-- Have it ticked by default -->
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1" />
<CustomAction Id="StartAppOnExit" FileKey="CryptobotEXE" ExeCommand="" Execute="immediate" Impersonate="yes" Return="asyncNoWait" />
<UI Id="WixUI_AdvancedCrypto">
<UIRef Id="WixUI_Advanced" />
<DialogRef Id="InstallScopeDlgDsktp" />
<Publish Dialog="AdvancedWelcomeEulaDlg" Control="Advanced" Event="NewDialog" Value="InstallScopeDlgDsktp" Order="1">!(wix.WixUISupportPerMachine) AND !(wix.WixUISupportPerUser)</Publish>
<Publish Dialog="InstallScopeDlgDsktp" Control="Back" Event="NewDialog" Value="AdvancedWelcomeEulaDlg">1</Publish>
<!-- override default WixAppFolder of WixPerMachineFolder as standard user won't be shown the radio group to set WixAppFolder -->
<Publish Dialog="InstallScopeDlgDsktp" Control="Next" Property="WixAppFolder" Value="WixPerUserFolder" Order="1">!(wix.WixUISupportPerUser) AND NOT Privileged</Publish>
<Publish Dialog="InstallScopeDlgDsktp" Control="Next" Property="ALLUSERS" Value="{}" Order="2">WixAppFolder = "WixPerUserFolder"</Publish>
<Publish Dialog="InstallScopeDlgDsktp" Control="Next" Property="ALLUSERS" Value="1" Order="3">WixAppFolder = "WixPerMachineFolder"</Publish>
<Publish Dialog="InstallScopeDlgDsktp" Control="Next" Property="APPLICATIONFOLDER" Value="[WixPerUserFolder]" Order="4">WixAppFolder = "WixPerUserFolder"</Publish>
<Publish Dialog="InstallScopeDlgDsktp" Control="Next" Property="APPLICATIONFOLDER" Value="[WixPerMachineFolder]" Order="5">WixAppFolder = "WixPerMachineFolder"</Publish>
<Publish Dialog="InstallScopeDlgDsktp" Control="Next" Event="NewDialog" Value="FeaturesDlg" Order="6">WixAppFolder = "WixPerUserFolder"</Publish>
<Publish Dialog="InstallScopeDlgDsktp" Control="Next" Event="NewDialog" Value="InstallDirDlg" Order="7">WixAppFolder = "WixPerMachineFolder"</Publish>
<Publish Dialog="FeaturesDlg" Control="Back" Event="NewDialog" Value="InstallScopeDlgDsktp">NOT Installed AND WixAppFolder = "WixPerUserFolder"</Publish>
<Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="InstallScopeDlgDsktp">!(wix.WixUISupportPerUser)</Publish>
<!-- Add the check box for launching the app on completion -->
<Publish Dialog="ExitDialog" Control="Finish" Order="1" Event="DoAction" Value="StartAppOnExit">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 AND NOT Installed</Publish>
</UI>
</Product>
</Wix>
And the InstallScopeDlgDsktp file is just a copy of InstallScopeDlg with a checkbox added and the name changed:
<snip>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<UI>
<Dialog Id="InstallScopeDlgDsktp" 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" NoPrefix="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" NoPrefix="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" NoPrefix="yes" Text="!(loc.InstallScopeDlgPerMachineDescription)">
<Condition Action="show">Privileged</Condition>
</Control>
<Control Id="DesktopShortcutCheckBox" Type="CheckBox" X="20" Y="160" Width="290" Height="17" Property="INSTALLDESKTOPSHORTCUT" CheckBoxValue="1" Text="Create a shortcut on the desktop." />
<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>
</Fragment>
</Wix>
You are still referencing the original WixUI_Advanced UI.
<UI Id="WixUI_AdvancedCrypto">
<UIRef Id="WixUI_Advanced" />
<DialogRef Id="InstallScopeDlgDsktp" />
This pulls in the InstallScopeDlg and will be causing your conflict. Take a copy of the WixUI_Advanced wxs from the wix sources and include in your project renaming it so that it doesn't conflict and then modify it to use your new InstallScopeDlgDsktop.