2

我正在为我的设置项目使用 WIX 3.5。如果我在安装过程中更改了安装目录,安装程序坚持使用默认目录。

<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="LocalAppDataFolder" Name="AppData">
    <Directory Id="InstallationDir" Name="MyApp" />
  </Directory>
</Directory>
...
<DirectoryRef Id="InstallationDir">
   ... component + files ...
</DirectoryRef>
...
<UI>
   <Property Id="WIXUI_INSTALLDIR" Value="InstallationDir" />
   <UIRef Id="WixUI_InstallDir" />
   <UIRef Id="WixUI_ErrorProgressText" />
</UI>

<CustomAction Id="SetARPINSTALLLOCATION" Property="ARPINSTALLLOCATION" Value="InstallationDir" />
<InstallExecuteSequence>
   <Custom Action="SetARPINSTALLLOCATION" After="InstallValidate" />
</InstallExecuteSequence>

我尝试了升级(我总是更改产品代码)和卸载/安装。同样的问题!如果我运行msiexec /L*v log.txt /i Setup.msi日志,则会告诉我该InstallationDir属性确实已更改。

问:我的软件怎么可能安装到默认目录中?

4

2 回答 2

2

您必须使用全大写的目录名称才能自定义。大写是 MSI 如何将目录(和属性)声明为 PUBLIC 并因此可自定义。

于 2012-09-06T15:13:59.670 回答
0

感谢您的解决方案。在找到这篇文章之前,我无法弄清楚为什么我的安装程序没有将文件复制到正确的用户指定目录。

我只想强调,如果您的安装程序将文件复制到 INSTALLDIR 下的子目录,那么它们的 ID 不能全部大写,否则当用户通过自定义安装对话框更改 INSTALDIR 时,它们不会被更改。您可以通过使用来验证

msiexec /i your_installer.msi /l*v log.log

并且您可以看到所有所有大写 ID 的任何目录都只会设置一次。

于 2015-02-09T21:25:01.600 回答