我正在使用MSBuild和MSBuild Community Tasks(使用XMLUpdate和XMLMassUpdate)来更新Web.config中的各个部分,但有一件事情让我困惑。如果我有:
<configuration>
<nlog throwExceptions="true" xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target name="file" xsi:type="File" fileName="${logDirectory}\SomeLog.log" layout="${message}"/>
</targets>
</nlog>
</configuration>
我试图替换 target
的 fileName
<XmlUpdate XmlFileName="$(BuildDir)\Builds\%(Configuration.Identity)\_PublishedWebsites\Presentation\Web.config"
XPath="//configuration/nlog/targets/target[@fileName]"
Value="${logDirectory}\SomeLog_%(Configuration.Identity).log" />
它报告无法找到任何要更新的内容,所以我的问题是如何更新filename属性?
编辑:这可能是名称空间冲突的情况吗,因为NLog部分定义了自己的名称空间?
更新:发布的回答声明命名空间无效。