Wix - 正确设置安装文件夹

Yon*_*Nir 19 installation wix

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

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

<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>
Run Code Online (Sandbox Code Playgroud)

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

<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>
    ...
Run Code Online (Sandbox Code Playgroud)

它继续以这种方式.还定义了"ICONS"目录的文件.

我也在使用WixUI_InstallDir对话框,我也提供了这些行:

<Property Id="WIXUI_INSTALLDIR" Value="Myapp_Installer_Dir" />
<UIRef Id="WixUI_InstallDir" />
Run Code Online (Sandbox Code Playgroud)

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

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

Yon*_*Nir 36

我终于找到了问题所在.搜索了一段时间后,我遇到了这个文件:

WixUI_InstallDir对话框集

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

正如您在我的代码中看到的那样:"Myapp_Installer_Dir"不符合此标准.

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