【问题标题】:WIX Directory Search Always FailsWIX 目录搜索总是失败
【发布时间】:2015-06-15 08:11:23
【问题描述】:

似乎无论我做什么,我在 WIX 中的产品中设置的任何条件都会阻止我的安装运行。下面我放了一些简单的代码来检查程序文件目录是否存在,如果存在,运行安装程序。我收到一条消息“找不到程序文件文件夹”。指示条件返回假。我在这里错过了什么?

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="SetupProject1" Language="1033" Version="1.0.0.0" Manufacturer="Toshiba" UpgradeCode="bb557911-769b-4a30-8461-3ad860ddc10e">
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate />

<Property Id="PFFOLDER" >
  <DirectorySearch Id="SystemFolderDriverVersion" Path="[ProgramFilesFolder]">
  </DirectorySearch>
</Property>

<Condition Message="Program files folder not found.">
  <![CDATA[PFFOLDER]]>
</Condition>


    <Feature Id="ProductFeature" Title="SetupProject1" Level="1">
        <ComponentGroupRef Id="ProductComponents" />
    </Feature>
</Product>

<Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
        <Directory Id="ProgramFilesFolder">
            <Directory Id="INSTALLFOLDER" Name="SetupProject1" />
        </Directory>
    </Directory>
</Fragment>

<Fragment>
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
        <!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
        <!-- <Component Id="ProductComponent"> -->
            <!-- TODO: Insert files, registry keys, and other resources here. -->
        <!-- </Component> -->
    </ComponentGroup>
</Fragment>

【问题讨论】:

  • 没有人找到解决办法?

标签: wix conditional-statements


【解决方案1】:

将 AssignToProperty="yes" 添加到 DirectorySearch 元素。另外我认为您不需要将属性名称包装在 CDATA 块中。

【讨论】:

  • 更改为: 没有不工作
【解决方案2】:

确保标准操作“AppSearch”在 InstallUISequence 和 InstallExecuteSequence 中的“LaunchConditions”之前运行。

AppSearch 操作用于填充您的 PFFOLDER 属性(如果目录存在)。然后您可以运行 LaunchConditions 操作以查看是否应允许安装...

【讨论】:

    【解决方案3】:

    我遇到了同样的问题(在 Windows 10 下)。但是当我以提升的权限运行安装程序时,它就可以工作了。奇怪的是,为了检查目录的存在,安装程序需要以管理员身份运行。

    【讨论】:

      猜你喜欢
      • 2013-10-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-19
      • 2017-07-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多