【发布时间】:2014-03-16 14:34:26
【问题描述】:
我有一个 Web 项目(ASP.NET MVC 4 项目),其中有许多配置存储在 Web.Config 和 NLog.config 文件中。
我有几个发布配置文件 PublishProfile1、PublishProfile2 等。当使用发布配置文件将我的 Web 项目部署到服务器时,我想更改一些配置部署后的两个配置文件(Web.config 中的一些应用设置和 NLog.config 中的一些值)。
我已按照 here 的步骤进行操作,它非常适合更改 Web.Config 中的设置(例如,Web.PublishProfile1.Config 中的转换受到尊重)。
这是我的 NLog.PublishProfile1.Config 转换文件:
<nlog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform" xmlns="http://www.nlog-project.org/schemas/NLog.xsd">
<nlog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets >
<target xsi:type="File"
name="tracelog"
fileName="NEW_VALUE_HERE" layout="${longdate} [${threadname}::${threadid}] ${pad:padding=5:inner=${level:uppercase=true}} ${logger} - ${message}"
xdt:Transform="Replace" xdt:Locator="Match(name)" />
</targets>
</nlog>
</nlog>
问题是我在 NLog.PublishProfile1.config 中有相同的转换,但这些转换在部署后也没有应用。
有没有人知道为什么这种转换对 NLog.config 不起作用但对发布配置文件上的 Web.config 工作正常?
【问题讨论】:
-
当你运行它时会发生什么?转换是否运行并将转换后的 Nlog.config 放置在输出目录中?
标签: asp.net-mvc xslt deployment web-config nlog