WiX wxs script with option to install on Selecting current-user or all-users install

StackOverflow https://stackoverflow.com/questions/829844

  •  06-07-2019
  •  | 
  •  

Question

I need a complete WiX script that can be build.It had

  1. Welcome
  2. EULA
  3. Install Folder
  4. Selecting current-user or all-users install
  5. Install
  6. Finish

I just need a single wxs file because it is for a simple application. Also I need an option to install it for the current user or all users.

Was it helpful?

Solution

have you checked the WixUI_Advanced UI that comes built-in in Wix3?

Here are the dialogs that it has:

  • AdvancedWelcomeEulaDlg
  • BrowseDlg
  • DiskCostDlg
  • FeaturesDlg
  • InstallDirDlg
  • InstallScopeDlg (for selecting user or per machine)
  • InvalidDirDlg

OTHER TIPS

I've also used the WixUI_InstallDir, but copied it and tweaked it according to my needs by adding some "What to do next" text at the end of the installer. I used this detailed walkthrough to take the stock Wix GUI and change a couple of the screen for my own purposes. This does require that you grab the Wix source code, but just for the purpose of getting the uncompiled versions of the actual Product.wxs file that the Wix developers include to drive the WixUI_InstallDir installer.

So basically I have something like this in a solution (using Votive add-in for VS):

  • MyWeb project
  • Wix Project
    • MyWeb.wxs - my product stuff obviously
    • Product.wxs - the Wix file that comes from the Wix source that defines the structure, flow, and content of the WixUI_InstallDir
    • My_InstallDir.wxs - This is where the fun happens. Essentially copied the source code Wix file, changed it to satisfy my needs, then made sure that in the Product.wxs I have a reference to my screen, not the original one.

Product.wxs

    <UI>
        <UIRef Id="My_InstallDir"/>
    </UI>

    <!-- Add the customized EULA -->
    <WixVariable Id="WixUILicenseRtf" Value="$(var.SolutionDir)\doc\license.rtf" />
    <Property Id="WIXUI_INSTALLDIR" Value="INSTALLLOCATION" />
    <UIRef Id="My_InstallDir" />
    <!-- Add the customized banner logo -->
    <WixVariable Id="WixUIBannerBmp" Value="$(var.SolutionDir)\doc\InstallerBanner.bmp" />
    <WixVariable Id="WixUIDialogBmp" Value="$(var.SolutionDir)\doc\InstallerSidebar.bmp" />

My_InstallDir.wxs is totally unchanged, apart from the line referring to my exit dialog, which is where my "What to do next" notes are:

<Publish Dialog="MyExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>

So then the real change is in the My_ExitDialog where I'm displaying the text:

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
    <UI>
        <Dialog Id="MyExitDialog" Width="370" Height="270" Title="!(loc.ExitDialog_Title) test">
            <Control Id="Finish" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Cancel="yes" Text="!(loc.WixUIFinish)" />
            <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Disabled="yes" Text="!(loc.WixUICancel)" />
            <Control Id="Bitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="234" TabSkip="no" Text="!(loc.ExitDialogBitmap)" />
            <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Disabled="yes" Text="!(loc.WixUIBack)" />
            <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
            <!--<Control Id="Description" Type="Text" X="135" Y="70" Width="220" Height="40" Transparent="yes" NoPrefix="yes" Text="!(loc.ExitDialogDescription)" />-->
            <Control Id="Title" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="!(loc.ExitDialogTitle)" />
            <Control Id="NextSteps" Type="ScrollableText" X="135" Y="70" Width="220" Height="140" Sunken="yes" TabSkip="no">
                <Text SourceFile="$(var.SolutionDir)\doc\GemWebAfterInstall.rtf" />
            </Control>
        </Dialog>

        <InstallUISequence>
            <Show Dialog="MyExitDialog" OnExit="success" />
        </InstallUISequence>

        <AdminUISequence>
            <Show Dialog="MyExitDialog" OnExit="success" />
        </AdminUISequence>
    </UI>
</Fragment>

I know you're looking for a solution, not pointers necessarily. However, using the article I reference as the key starting point, I think you can find all of the parts you need either in the ready-baked WixUI bits, or by replacing small pieces of the "out-of-the-box" stuff like I have. Good luck.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top