I am new to WiX and am trying to use WixUI_Advanced and then replacing the
InstallScopeDlg with my own version (called InstallScopeDlgDsktp) which
includes a checkbox for adding a Desktop shortcut.

I attempt to do this by copying all the lines that reference the old
InstallScopeDlg in the WixUI_Advanced.wxs file, into my main file
(Cryptobot.wxs) and change them to 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 both 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 being linked in and
adding the RadioButton?


Here's my code 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="5ee77dbe-7991-4314-95a3-01011e7acef6"
      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="81aba90d-37b9-4191-86b2-c6c98ddedda4">
                     <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="716c4594-99d4-44d1-b997-d9638cc128d0" >
                  <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="f0df1ea4-71e7-41e2-bdf1-dcc912cfdfaa">
               <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="5ee77dbe-7991-4314-95a3-01011e7acef6">
         <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.wxs is a copy of InstallScopeDlg, renamed and
with a checkbox for the desktop shortcut:
<?xml version="1.0" encoding="UTF-8"?>
<!--
    Copyright (c) Microsoft Corporation.  All rights reserved.

    The use and distribution terms for this software are covered by the
    Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php)
    which can be found in the file CPL.TXT at the root of this distribution.
    By using this software in any fashion, you are agreeing to be bound by
    the terms of this license.

    You must not remove this notice, or any other, from this software.
-->
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi";>
    <Fragment>
        <UI>
            <Dialog Id="InstallDirDlgDsktpShrtCt" 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="WIXUI_INSTALLDIR" Indirect="yes" />
                <Control Id="ChangeFolder" Type="PushButton" X="20" Y="120"
Width="56" Height="17" Text="!(loc.InstallDirDlgChange)" />
                <Control Id="DesktopShortcutCheckBox" Type="CheckBox"
X="20" Y="160" Width="290" Height="17" Property="INSTALLDESKTOPSHORTCUT"
CheckBoxValue="1" Text="Create a shortcut on the desktop." />
            </Dialog>
        </UI>
    </Fragment>
</Wix>

Any assistance is much appreciated, have been stuck on this for a couple of
days now.

Cheers,
Daniel
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to