WIX在安装时检查文件是否存在

WIX在安装时检查文件是否存在,wix,Wix,我的WIX安装程序有问题。我想检查是否存在一个特殊的文件,如果,它应该安装,否则不。因此,目前我正在进行文件搜索: <Property Id="FileExists"> <DirectorySearch Id="CheckFileDir" Path="..." Depth="0"> <FileSearch Id="CheckFile" Name="Some.dll"/> </DirectorySearch> </Propert

我的WIX安装程序有问题。我想检查是否存在一个特殊的文件,如果,它应该安装,否则不。因此,目前我正在进行文件搜索:

<Property Id="FileExists">
  <DirectorySearch Id="CheckFileDir" Path="..." Depth="0">
    <FileSearch Id="CheckFile" Name="Some.dll"/>
  </DirectorySearch>
</Property>

如果功能级别不存在,则将其设置为null:

<Feature Id="Feature_1" Title="Feature_1" Level="1">
  <ComponentRef Id="ComponentId"/>
  <Condition Level="0">NOT FileExists</Condition>
</Feature>

不存在文件
但我的组件必须是什么样子

<Component Id="ComponentID" Directory="Direc" KeyPath="yes" Guid="GUID_FD6FB7A51317" >
  <File Id="FileId" Name="file.dll" Source="$(var.accessPath)access.dll" Vital="no"/>
</Component>

如果这样做,我会收到一条错误消息,即找不到文件“$(var.accessPath)access.dll”

编辑1:accessPath定义为:

<?define accessPath="%Variable%\bin\"?>

正如Tom Blodget在评论中提到的那样,我混淆了WiX和Windows Installer的概念


如果要在安装过程中检查文件是否存在,必须使用自定义操作。

如何定义$(var.SimuarteaccessPath)?%PUMA%是您的环境变量?如果是,则应定义它
yes,它是一个环境变量,但仅在少数系统上安装。您混淆了WiX和Windows Installer的概念<代码>