基于文件文件版本获取变量的众所周知的技巧是
<?define ProductVersion = !(bind.FileVersion.filProductVersion) ?>
,其中
<Fragment>
<ComponentGroup Id="MyCG">
<Component Id="cmpabc" Directory="INSTALLDIR" Guid="YOUR-GUID-HERE">
<File Id="filProductVersion" KeyPath="yes" Source="$(var.MyRootFolder)\fileIAmGoingToInstall.dll" />
</Component>
是否有根据我不想安装的文件的文件版本设置变量?
我试过这个:
MyWxs.wxs
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<Binary Id="binaryProductVersionId" SourceFile="$(var.MyRootFolder)\FileIDoNotWantToInstall.dll" />
</Fragment>
</Wix>
MyWxi.wxi
<?xml version="1.0" encoding="utf-8"?>
<Include>
<?define ProductVersion = !(bind.FileVersion.binaryProductVersionId) ?>
</Include>
但我明白了:
Severity Code Description Project File Line Suppression State
Error Unresolved bind-time variable !(bind.FileVersion.binaryProductVersionId).
答案 0 :(得分:1)
您可以尝试在组件中放置始终为false的条件。
<Component Id="cmpabc" Directory="INSTALLDIR" Guid="YOUR-GUID-HERE">
<File Id="filProductVersion" KeyPath="yes" Source="$(var.MyRootFolder)\fileIAmGoingToInstall.dll" />
<Condition>IGNORE = "0"</Condition>
</Component>
其中IGNORE可以是属性或使用变量$(var.IGNORE)