似乎无论我做什么,我在 WIX 中放入我的产品的任何条件都会阻止我的安装运行。下面我放了一些简单的代码,用于检查程序文件目录是否存在,如果存在,则运行安装程序。我收到一条消息,提示“未找到程序文件文件夹”。指示条件返回false。我在这里缺少什么?
<?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>
最佳答案
将 AssignToProperty="yes"添加到 DirectorySearch 元素。此外,我认为您不需要将属性名称包装在 CDATA 块中。
关于WIX 目录搜索总是失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29547348/