简体   繁体   English

Wix - 自定义安装目录

[英]Wix - Custom installation directory

I'm using Wix 3.x and the user should be able to choose the target directory.我正在使用 Wix 3.x,用户应该能够选择目标目录。 My Setup.wxs is currently like here: http://pastebin.com/uH1EjbDQ我的 Setup.wxs 目前是这样的: 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? (INSTALLDIR/TARGETDIR?!)我见过人们在那里建立自己的对话框页面的例子,但这并不是真正必要的,是吗?

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:<UIRef Id="WixUI_Mondo" />但在</Product>之前,我收到以下错误:

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.现在,当我删除<UIRef Id="WixUI_Mondo" />我可以构建设置。 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谢谢,菲利普

The UIRef element refers to one of the standard user interface sequences provided by WiX: UIRef 元素指的是 WiX 提供的标准用户界面序列之一:

  • WixUI_Mondo WixUI_Mondo
  • WixUI_Advanced WixUI_高级
  • WixUI_FeatureTree WixUI_FeatureTree
  • WixUI_InstallDir WixUI_InstallDir
  • WixUI_Minimal 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 see the WiX documentation .有关每个序列中包含哪些对话框的信息,请参阅WiX 文档

The WixUI_Mondo allows the user to specify the installation directory if they choose a Custom install.如果用户选择自定义安装,WixUI_Mondo 允许用户指定安装目录。 Only WixUI_Mondo allows the user to choose a typical, custom or complete install.只有 WixUI_Mondo 允许用户选择典型安装、自定义安装或完整安装。

The simplest way to allow the user to choose the installation directory is to use the WixUI_InstallDir dialog sequence.允许用户选择安装目录的最简单方法是使用 WixUI_InstallDir 对话框序列。

SharpDevelop's own installer uses the WixUI_FeatureTree dialog sequence. SharpDevelop 自己的安装程序使用 WixUI_FeatureTree 对话框序列。

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 .因此,如果 WiX 提供的一组标准对话框不是您想要的,您可以查看自定义对话框序列 Creating your own custom dialogs is generally the last resort.创建您自己的自定义对话框通常是最后的手段。

This link explains how to do it in simple way. 此链接说明了如何以简单的方式执行此操作。

link UIRef 链接UIRef

IsWiX supports this feature. IsWiX 支持此功能。 Take a look at:看看:

IsWiXMerges.wxs IsWiXMerges.wxs

IsWiXInstaller.wxs IsWiXInstaller.wxs

The trick is that I'm using a Directory named INSTALLLOCATION along with a UIRef of WiXUI_*.诀窍是我正在使用名为 INSTALLLOCATION 的目录以及 WiXUI_* 的 UIRef。 This is what the WiXUI uses similar to the way InstallShield uses INSTALLDIR and Visual Studio uses TARGETDIR.这是 WiXUI 使用的类似于 InstallShield 使用 INSTALLDIR 和 Visual Studio 使用 TARGETDIR 的方式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM