Wix - 正确设置安装文件夹 [英] Wix - Setting Install Folder correctly

查看:40
本文介绍了Wix - 正确设置安装文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 VS 2010 创建一个由 Wix 安装的程序,并且我已经准备好 product.wxs.

I'm creating a program which is being installed by Wix, using VS 2010 and I've already got the product.wxs ready.

在我的 wxs 文件中,我有如下所示的目录定义:

In my wxs file, I've got directory definitions which looks like this:

<SetDirectory Id="INSTALLFOLDER" Value="[WindowsVolume]Myapp" />
<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="INSTALLFOLDER" Name="Myapp">
    <Directory Id="Myapp_Installer_Dir" Name="Myapp">
          <Directory Id="BIN" Name="Bin" />
          <Directory Id="ICONS" Name="Icons" />
    </Directory>
  </Directory>
</Directory>

然后我得到了这些文件安装定义:

And then I got these file installation definitions:

<DirectoryRef Id="Myapp_Installer_Dir">
  <Component Id="INSTALLER_Myapp" Guid="{94F18477-8562-4004-BC6F-5629CC19E4CB}" >
    <File Source="$(var.Myapp.TargetPath)" KeyPath="yes"/>
  </Component>
</DirectoryRef>

<DirectoryRef Id="BIN">
  <Component Id="INSTALLER_Data" Guid="{545FB5DD-8A52-44D7-898E-7316E70A93F5}" >
    <File Source="$(var.Data.TargetPath)" KeyPath="yes"/>
  </Component>
    ...

它以这种方式继续.也定义了图标"目录的文件.

And it continues in that manner. The files for the "ICONS" directory are defined as well.

我也在使用 WixUI_InstallDir 对话框集,我也得到了这些行:

I am also using the WixUI_InstallDir dialog set and I got these lines present as well:

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

问题是当用户安装程序并更改安装文件夹的值时,Bin"和Icons"的文件安装到了正确的路径,但Myapp目标安装到了一个修复位置一开始就定义为默认安装路径.

The problem is when the user installs the program and changes the value of the installation folder, the files of the "Bin" and "Icons" are installed to their correct path, but the Myapp target is installed to a fix location which was defined at the start as the default installation path.

为什么只有 bin 和 icon 文件安装到用户想要的正确文件夹,而 myapp 目标没有?

Why do only the bin and icon files installed to the correct folder the user wanted, but the myapp target does not?

推荐答案

我终于找到了问题所在.找了一会,发现了这个文档:

I have finally figured out the problem. After searching for a while, I came across this document:

WixUI_InstallDir 对话框集

相关部分:目录ID必须全大写,因为它必须从UI传递到执行序列才能生效."

The relevant part: "The directory ID must be all uppercase characters because it must be passed from the UI to the execute sequence to take effect."

正如您在我的代码中看到的:Myapp_Installer_Dir"不符合此条件.

And as you can see in my code: "Myapp_Installer_Dir" does not meet this criteria.

将其更改为MYAPPINSTALLERDIR"后,一切正常.

After changing it to "MYAPPINSTALLERDIR", everything worked.

这篇关于Wix - 正确设置安装文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆