2
我在WiX工程文件,写这(我简化我的例子):WiX:是否可以使用变量名称作为其他变量名称的一部分?
<?define info = R172 ?>
<?define var1="$(var.info.TargetPath)" ?>
<?define var2="$(var.info.TargetDir)" ?>
我想info
将被预处理器扩展到这样的变体:
<?define var1="$(var.R172.TargetPath)" ?>
<?define var2="$(var.R172.TargetDir)" ?>
但我得到的错误:
Undefined preprocessor variable
$(var.info.TargetPath)
.
这种变异没有工作过:
<?define var1="$(var.$(var.info).TargetPath)" ?>
<?define var2="$(var.$(var.info).TargetDir)" ?>
而且我已经尝试使用foreach
:
<?foreach info in R172?>
<?define var1="$(var.info.TargetPath)" ?>
<?define var2="$(var.info.TargetDir)" ?>
<?endforeach?>
,但我得到了同样的问题。
可以以某种方式做类似的替换吗?
UPD
即我想用它通过foreach
与引用的项目工作:
<!-- The list of the names of referensed projects -->
<?define ACAD_VERSIONS=R172;R182;R190?>
<?foreach ACAD in ACAD_VERSIONS?>
<Feature Id="Feature.$(var.ACAD)" Title="$(var.ACAD)" Level="1">
<Component Id="cmp$(var.ACAD)" Guid="*" Directory="INSTALLFOLDER">
<File Id="extension.$(var.ACAD).dll" Source="$(var.$(var.ACAD).TargetPath)" KeyPath="yes"/>
</Component>
</Feature>
<?endforeach?>
但是,我想通过'foreach'循环来处理其内容时使用'var1'类似于引用项目的链接。为了清晰起见,我在示例中添加了** UPD **部分。 –
谢谢。即此功能已添加到WiX 4版本中。我的理解正确吗? –
不幸的是,这个功能也不在WiX版本4中。 [嵌套预处理器变量](https://github.com/wixtoolset/issues/issues/4007)的当前状态显示它是开放的并且计划用于WiX版本4。 – bradfordrg