【发布时间】:2015-03-19 14:42:35
【问题描述】:
我正在尝试做的是transform 之一,appSettings 在外部文件中:
这里是 external.config
<?xml version="1.0"?>
<appSettings>
<add key="SomeKey" value="some value" />
</appSettings>
Web.config
<?xml version="1.0"?>
<configuration>
<appSettings file="..\..\external.config">
<add key="SomeKey1" value="some value 1" />
</appSettings>
</configuration>
Web.Debug.config
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<appSettings>
<add key="SomeKey" value="some changed value"xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/>
</appSettings>
</configuration>
在构建正确的configuration(在我的示例中为Debug)之后,只有这个:
<?xml version="1.0"?>
<configuration>
<appSettings file="..\..\external.config">
<add key="SomeKey1" value="some value 1" />
</appSettings>
</configuration>
但应该是:
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<appSettings>
<add key="SomeKey1" value="some value 1" />
<add key="SomeKey" value="some changed value"/>
</appSettings>
</configuration>
我尝试将appSettings 共享为 2 个或更多不同的 project 1-st 是 WCF Service 第二个 ASP.NET MVC 4 Application
已编辑:
我已尝试将此 file attribute 移动到 Web.Debug.config 但它也不起作用。
问题是:
我怎样才能完成这样的事情?有可能吗?
【问题讨论】:
-
您在上面找到的任何解决方案?谢谢
标签: asp.net-mvc wcf-configuration web.config-transform