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

查看:280
本文介绍了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和图标文件安装到用户想要的正确文件夹中,而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天全站免登陆