新鲜问这个问题->
我有一个需要使用 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">
<?--... Various 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" />
<?--... More of the WIX XML file ...-->
<iis:WebApplication Id='STWebApp' Name='MyWebSite' Isolation='medium' />
<?--... Rest of the WIX XML file ...-->
我的问题是 SDC 任务似乎无法引用任何与 WIX 相关的 xml 节点。例如:
<XmlFile.SetAttribute Path="$(MSBuildProjectDirectory)\TestProduct.wxs"
XPath="//iis:WebApplication" Namespaces="@(Namespaces)"
Name="Name" Value="$(VersionTag)"/>
工作得很好,因为它不使用任何 Wix 节点(只是一个 iis 节点),但是如果我使用它的完整 XPath 路径(/Wix/Product/iis:WebApplication)任务返回: 找不到资源字符串没有找到匹配项对于 XPath 表达式
在我想引用目录节点(/Wix/Product/Directory/Directory/Directory/Directory[@Id='STWebSiteDir'])之前,这不是问题
我尝试使用完整的 XPath 和较短的 //Directory[@Id='STWebSiteDir']。我尝试过单引号和双引号,我尝试将 WIX 命名空间添加到调用中(没有前缀)。
<ItemGroup>
<Namespaces Include="http://schemas.microsoft.com/wix/IIsExtension">
<Prefix>iis</Prefix>
<Uri>http://schemas.microsoft.com/wix/IIsExtension</Uri>
</Namespaces>
<Namespaces Include="http://schemas.microsoft.com/wix/2006/wi">
<Prefix></Prefix>
<Uri>http://schemas.microsoft.com/wix/2006/wi</Uri>
</Namespaces>
</ItemGroup>
我什至试图获得对 /Wix/Product 的引用,即使这样也失败了:
<XmlFile.SetAttribute Path="$(MSBuildProjectDirectory)\TestProduct.wxs"
XPath="/Wix/Product" Namespaces="@(Namespaces)"
Name="Name" Value="MODIFIED"/>
我显然错过了一些东西。任何人都暗示去哪里让它工作?
瓦卡诺