题
我有一个需要使用MSBuild修改的WIX文件。它是这样开始的:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:iis="http://schemas.microsoft.com/wix/IIsExtension">
<?--... Removed Params ...-->
<?define ProductVersion = "1.0.1"?>
<?--... Removed Params ...-->
<Product Id='$(var.ProductCode)'
UpgradeCode='$(var.UpgradeCode)'
Name='$(var.AppName)' Language="1033" Version='$(var.ProductVersion)'
Manufacturer='$(var.Manufacturer)'>
<Package Id='$(var.PackageCode)' InstallerVersion="200"
Compressed="yes" />
<?--... Rest of the WIX XML file ...-->
我的问题是我不知道XPath对&lt;?define ProductVersion =&quot; 1.0.1&quot;?&gt;
会是什么。有没有办法通过XPath引用它,所以我可以使用SDC SetValue MSBuild任务来改变它?它不是一个节点(我认为)所以我不确定如何引用它。
Vaccano
解决方案
看起来 / Wix / processing-instruction('define')
可能适用于XPath(无论MSBuild是否识别出来,我都不知道)。
通过将其插入 SketchPath ,我可以在其中单击并测试各种XPath以查看什么会选择那个元素。
其他提示
另一种方法是通过命令行将参数定义为蜡烛:
candle -dProductVersion=1.0.1
//处理指令( '定义')
&lt;?define&gt;
是一个处理指令节点,因此您应该能够使用XPath表达式来解决它,例如
//processing-instruction('define')
不隶属于 StackOverflow