banner



How To Change Page Url On Wix

Adding and Customizing Dialogs in WiX iii

How to add a user interface, optionally create a shortcut on the desktop, and conditionally launch your app after installation


So you've downloaded WiX three, you've gone through Lesson 1 of 1000�bor DE�G JAHN's first-class WiX tutorial, and you've got files getting installed and uninstalled. You're gear up to add an interface, merely Lesson Ii of the tutorial is written for WiX version 2, and the instructions don't seem to be working.

Maybe you've searched the web and found a mode to get a user interface showing upwardly, just can't figure out how to add a checkbox to perform an optional action. This folio will hopefully answer that for you.


Calculation support for a user interface

If you are using the Visual Studio integration, right-click on the "References" folder of your setup projection and add the WixUIExtension.dll file as a reference. You lot should besides go to your project's properties (correct-click the project name in the Solution Explorer and select "Properties"), go to the "Linker" tab, and in the edit control next to "Cultures:" enter "en-United states of america" (without the quotes).

If you are using the WiX control line, you'll need to specify the following on the calorie-free.exe command line:

-cultures:en-US -ext WixUIExtension.dll

If low-cal.exe can't find information technology, you lot may need to specify the path to the WixUIExtension.dll.


Selecting a user interface

WiX iii provides v bones user interface styles: WixUI_Mondo, WixUI_FeatureTree, WixUI_InstallDir, WixUI_Minimal, and WixUI_Advanced. Information on the differences betwixt these is easy to find and is included with the WiX help file. This example will focus on the WixUI_Installer set of dialogs, but can be adjusted to the other styles easily. To add the WixUI_Installer user interface (or WiX dialog gear up) to your setup, add the following elements on the primary installation level of the setup file (inside the the <Wix>...</Wix> element block):

<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR"/> <UIRef Id="WixUI_InstallDir" />          

Note the <Holding> element. That is necessary only for the WixUI_InstallDir user interface, and the INSTALLDIR value should exist replaced with the ID of the <Directory> element where your main application will get installed.

After adding the <UIRef> element and linking with the WixUIExtension library, your setup program should have the selected user interface.

If you run into problems edifice the setup with Visual Studio, make sure you've specified the civilization in the linker settings. Also try right-clicking the projection name and selecting "Rebuild All". If y'all're still having problems, try shutting down and restarting Visual Studio, re-opening the setup project, and Rebuilding All once again. If you're still running into bug, the WiX SourceForge page has some great supportive mailing lists you can search or bring together.


Adding a checkbox to conditionally install a desktop shortcut

Customizing a dialog by adding a checkbox is non much more than complicated. This instance will use the WixUI_InstallDir user interface, and will add a checkbox to the dialog that gives the user a gamble to modify the installation directory. Extending this example to customize another dialog in another dialog serial should be straightforward.

Don't worry - you lot won't take to recompile WiX, simply you will need to download the source lawmaking for the build of WiX that you are using. For this case, yous'll need to copy two files out of the WiX source tree into your own setup project directory: WixUI_InstallDir.wxs and InstallDirDlg.wxs. Once in your own directory, rename these files MyWixUI_InstallDir.wxs and MyInstallDirDlg.wxs respectively.

Showtime, you'll need a property that indicates whether or not to place a shortcut on the desktop. Add the post-obit lawmaking to your setup file, at the same level equally the <UIRef> chemical element (it'due south important that the property name exist in all caps - this signifies that information technology's a global property):

<Property Id="INSTALLDESKTOPSHORTCUT" Value="i" />          

You'll too need a component section to conditionally identify the shortcut depending on the value of the INSTALLDESKTOPSHORTCUT holding. If you already accept an individual component that installs the shortcut, you tin merely add together the conditional. Otherwise, your lawmaking might look as follows (supplant the highlighted sections with what fits for your installation):

<Directory Id="DesktopFolder" Proper name="Desktop">     <Component Id="DesktopShortcut" Guid="YOUR-GUID-Hither">     <Condition>INSTALLDESKTOPSHORTCUT</Condition>     <RegistryKey Root="HKCU" Key="YourAppKey\PossibleSubKey" Action="createAndRemoveOnUninstall">         <RegistryValue Proper noun="AnyValueName" Value="ane" Type="integer" KeyPath="yep"/>     </RegistryKey>     <Shortcut Id="DesktopShortcut" Directory="DesktopFolder" Name="ShortcutName" ShortName="ShrtName" Icon="YourApp.exe" Target="[#YourAppExeId]"/>     </Component> </Directory>          

Of course, you'll also need to add together a respective <ComponentRef> element inside your awarding'southward <Characteristic> element.

You'll now have a shortcut that gets installed based on the value of the INSTALLDESKTOPSHORTCUT property. Now we demand to add the checkbox to the directory dialog. Load upwards your copy of MyInstallDirDlg.wxs and make the following changes:

<?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="MyInstallDirDlg" Width="370" Pinnacle="270" Title="!(loc.InstallDirDlg_Title)">                 .                 .                 .                 <Control Id="FolderLabel" Blazon="Text" X="twenty" Y="threescore" Width="290" Pinnacle="thirty" Text="!(loc.InstallDirDlgFolderLabel)" />                 <Control Id="Folder" Type="PathEdit" 10="20" Y="100" Width="320" Height="18" Property="WIXUI_INSTALLDIR" Indirect="yes" />                 <Control Id="ChangeFolder" Type="PushButton" X="20" Y="120" Width="56" Pinnacle="17" Text="!(loc.InstallDirDlgChange)" />            <Command Id="DesktopShortcutCheckBox" Type="CheckBox" 10="xx" Y="160" Width="290" Height="17" Belongings="INSTALLDESKTOPSHORTCUT" CheckBoxValue="one" Text="Create a shortcut for this plan on the desktop." />            </Dialog>         </UI>     </Fragment> </Wix>          

2 more changes are necessary. You need to alter your MyWixUI_InstallDir.wxs file to use the new MyInstallDirDlg. Load upwards your copy of MyWixUI_InstallDir.wxs and make the post-obit changes:

<?xml version="i.0" encoding="UTF-eight"?>  <!--     Copyright (c) Microsoft Corporation.  All rights reserved. --> <!-- First-time install dialog sequence:      Maintenance dialog sequence:  - WixUI_WelcomeDlg                     - WixUI_MaintenanceWelcomeDlg  - WixUI_LicenseAgreementDlg            - WixUI_MaintenanceTypeDlg  - WixUI_InstallDirDlg                    - WixUI_InstallDirDlg    - WixUI_VerifyReadyDlg                 - WixUI_VerifyReadyDlg    - WixUI_DiskCostDlg -->  <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">     <Fragment>         <UI Id="MyWixUI_InstallDir">             .             .             .             <Publish Dialog="LicenseAgreementDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>             <Publish Dialog="LicenseAgreementDlg" Control="Side by side" Event="NewDialog" Value="MyInstallDirDlg">LicenseAccepted = "1"</Publish>              <Publish Dialog="MyInstallDirDlg" Control="Back" Effect="NewDialog" Value="LicenseAgreementDlg">ane</Publish>             <Publish Dialog="MyInstallDirDlg" Control="Side by side" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Club="ane">i</Publish>             <Publish Dialog="MyInstallDirDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="2">1</Publish>             <Publish Dialog="MyInstallDirDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="one">1</Publish>             <Publish Dialog="MyInstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>              <Publish Dialog="VerifyReadyDlg" Command="Back" Issue="NewDialog" Value="MyInstallDirDlg" Order="1">NOT Installed</Publish>             <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed</Publish>             .             .             .             </UI>          <UIRef Id="WixUI_Common" />     </Fragment> </Wix>          

Y'all'll too need to update the <UIRef> element yous previously added on the principal installation level of the setup file (within the <Wix>...</Wix> element block) so it points to your new dialog:

<UIRef Id="MyWixUI_InstallDir" />          

Now add together the MyWixUI_InstallDir.wxs and MyInstallDirDlg.wxs files to your setup project, compile it, and your new install directory dialog should look as follows:

And the desktop shortcut will simply be added if the checkbox is checked!


Conditionally launching the application after installation

There are two ways to add a checkbox to the terminal page of an installation in club to conditionally launch an application. The first is supported in WiX iii without needing whatsoever changes to the original dialogs, but it has a major limitation.

The final dialog box (ExitDialog) has an optional checkbox that can exist displayed, and the property tied to this checkbox can exist used to conditionally launch the application. The post-obit entries in the setup file volition add together this checkbox (over again, replace the entries in yellowish with your own):

<CustomAction Id="StartAppOnExit" FileKey="YourAppExeId" ExeCommand="" Execute="immediate" Impersonate="aye" Return="asyncNoWait" /> <Holding Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch Sample App 1.0 when setup exits." /> <UI>     <Publish Dialog="ExitDialog" Control="Finish" Order="1" Consequence="DoAction" Value="StartAppOnExit">WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT</Publish> </UI>          

The to a higher place code will add together the following checkbox to the ExitDialog:

Note the greyness background backside the checkbox. Unfortunately at that place's no easy way to fix this, without fixing information technology in the WiX source code. Because the command'southward groundwork uses the default dialog background colour, irresolute the background image for the dialog to friction match won't actually solve annihilation. It would still look out of place on different versions of Windows that utilise other default background colors, and on the machines of users that change their Windows colour scheme.

The other method of adding a checkbox and conditionally launching an awarding later on setup is to create a new checkbox control similar we did for the desktop shortcut. If yous added a checkbox for the desktop shortcut, so yous already have a re-create of WixUI_InstallDir.wxs in your setup project named MyWixUI_InstallDir.wxs. Yous'll also need to copy ExitDialog.wxs into your project directory and rename information technology MyExitDialog.wxs. Then make the following changes to the file:

<?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="MyExitDialog" Width="370" Height="270" Championship="!(loc.ExitDialog_Title)">                 <Control Id="Stop" Type="PushButton" 10="236" Y="243" Width="56" Height="17" Default="aye" Cancel="yeah" Text="!(loc.WixUIFinish)" />                 <Command Id="Abolish" Type="PushButton" X="304" Y="243" Width="56" Peak="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" Acme="17" Disabled="yeah" Text="!(loc.WixUIBack)" />                 <Command Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Top="0" />                 <Control Id="Description" Type="Text" Ten="135" Y="lxx" Width="220" Height="20" Transparent="yes" NoPrefix="aye" Text="!(loc.ExitDialogDescription)" />                 <Control Id="Championship" Type="Text" X="135" Y="twenty" Width="220" Height="60" Transparent="yes" NoPrefix="yep" Text="!(loc.ExitDialogTitle)" />            <Control Id="OptionalText" Type="Text" X="135" Y="100" Width="220" Elevation="80" Transparent="yes" NoPrefix="yes" Hidden="yep" Text="[WIXUI_EXITDIALOGOPTIONALTEXT]">            <Condition Activeness="show">WIXUI_EXITDIALOGOPTIONALTEXT AND NOT Installed</Status>            </Control>            <Control Id="OptionalCheckBox" Type="CheckBox" X="135" Y="190" Width="220" Peak="40" Hidden="yes" Belongings="WIXUI_EXITDIALOGOPTIONALCHECKBOX" CheckBoxValue="one" Text="[WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT]">            <Condition Activity="show">WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT AND Not Installed</Condition>            </Control>            <Command Id="LaunchCheckBox" Type="CheckBox" X="10" Y="243" Width="170" Height="17" Property="LAUNCHAPPONEXIT" Subconscious="yes" CheckBoxValue="ane" Text="Launch Sample App one.0 when setup exits.">            <Condition Action="show">Non Installed</Status>            </Command>            </Dialog>              <InstallUISequence>                 <Show Dialog="MyExitDialog" OnExit="success" />             </InstallUISequence>              <AdminUISequence>                 <Show Dialog="MyExitDialog" OnExit="success" />             </AdminUISequence>         </UI>     </Fragment> </Wix>          

You'll also need to brand the following alter to your MyWixUI_InstallDir.wxs file:

            .             .             .             <Publish Dialog="MyExitDialog" Command="Finish" Event="EndDialog" Value="Render" Gild="999">1</Publish>             .             .             .          

Add together the new MyExitDialog.wxs file to your project, and instead of the above grayness checkbox on a white background, you'll terminate upwardly with the following:

Finally, to get the application to really launch you'll need to add code similar to the previous pick, replacing the highlighted pieces with what makes sense for your setup:

<CustomAction Id="LaunchApplication" FileKey="YourAppExeId" ExeCommand="" Execute="immediate" Impersonate="yes" Return="asyncNoWait" /> <UI>   <Publish Dialog="MyExitDialog" Command="Finish" Gild="1" Event="DoAction" Value="LaunchApplication">LAUNCHAPPONEXIT</Publish> </UI>          


That's it!

Hopefully these instructions will exist useful to someone. I know it took a very long, frustrating 24-hour interval before I pieced plenty information together to figure all this out. Again, if yous come across any bug that haven't been covered here, the WiX SourceForge folio has excellent email lists, the athenaeum of which are searchable and provide a wealth of tips from users who have probably come across whatever information technology is you lot're having problems with. On the off chance you can't observe what yous're looking for in the archives, you tin ever bring together!

Source: http://www.dizzymonkeydesign.com/blog/misc/adding-and-customizing-dlgs-in-wix-3/

Posted by: xiongbefornes.blogspot.com

0 Response to "How To Change Page Url On Wix"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel