问题
I'm using Wix 3.x and the user should be able to choose the target directory. My Setup.wxs is currently like here: http://pastebin.com/uH1EjbDQ
What is the simplest way to ask the user for a custom target directory? (INSTALLDIR/TARGETDIR?!) I have seen example in which people build there own dialog pages but this isn't really necessary, is it?
Update:
When I add
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR"/>
<UIRef Id="WixUI_InstallDir" />
after <UIRef Id="WixUI_Mondo" />
but before </Product>
I get the following error:
The primary key 'ExitDialog/Finish/EndDialog/Return/1' is duplicated in table 'ControlEvent'. Please remove one of the entries or rename a part of the primary key to avoid the collision. (LGHT0130) - C:\delivery\Dev\wix30_public\src\ext\UIExtension\wixlib\WixUI_Mondo.wxs:44
Now when I remove <UIRef Id="WixUI_Mondo" />
I can build the setup. But the dialog "Choose Setup Type" (Complete, Typical, Custom) is not shown anymore. And another weird thing: Sometimes a dialog pops up, stating it calculates disk space (it has a cancel button), but eventually it never closes by itself. When I close it I can still continue. Is there a way to fix this in a simple manner?
Thanks, Philip
回答1:
The UIRef element refers to one of the standard user interface sequences provided by WiX:
- WixUI_Mondo
- WixUI_Advanced
- WixUI_FeatureTree
- WixUI_InstallDir
- WixUI_Minimal
You can only use one of these sequences in your installer. Each one of these has a set of dialogs. For information on what dialogs are included in each of these sequences the WiX wiki has a good overview.
The WixUI_Mondo allows the user to specify the installation directory if they choose a Custom install. Only WixUI_Mondo allows the user to choose a typical, custom or complete install.
The simplest way to allow the user to choose the installation directory is to use the WixUI_InstallDir dialog sequence.
SharpDevelop's own installer uses the WixUI_FeatureTree dialog sequence.
So if one of the standard sets of dialogs provided by WiX is not what you want you could look at customising the dialog sequence. Creating your own custom dialogs is generally the last resort.
回答2:
IsWiX supports this feature. Take a look at:
IsWiXMerges.wxs
IsWiXInstaller.wxs
The trick is that I'm using a Directory named INSTALLLOCATION along with a UIRef of WiXUI_*. This is what the WiXUI uses similar to the way InstallShield uses INSTALLDIR and Visual Studio uses TARGETDIR.
来源:https://stackoverflow.com/questions/4693134/wix-custom-installation-directory