我正在使用MSBuild和MSBuild 社区任务(使用 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>
fileName
我尝试替换target
<XmlUpdate XmlFileName="$(BuildDir)\Builds\%(Configuration.Identity)\_PublishedWebsites\Presentation\Web.config"
XPath="//configuration/nlog/targets/target[@fileName]"
Value="${logDirectory}\SomeLog_%(Configuration.Identity).log" />
它报告无法找到任何要更新的内容,所以我的问题是如何更新文件名属性?
编辑:这可能是命名空间冲突的情况,因为 NLog 部分定义了自己的命名空间?
更新:发布的声明名称空间的答案不起作用。