2011-12-20 37 views
1

我不知道是否有一种方法或一种变通方法有以下结构的配置文件:有没有办法使用configSource在配置文件中有几个层次结构?

App.Config中

<configuration> 
    <appSettings configSource="AppSett.config"> 
    <add key="test1" value="test2"/> 
    </appSettings> 
</configuration> 

和我AppSett.config的样子:

<appSettings> 
    <add key="test3" value="test3"></add> 
</appSettings> 
+0

你想用这个做什么? – 2011-12-20 23:32:20

回答

3

不,您不能使用部分信息的外部文件来链接,而不是使用默认的配置结构。配置文件是符合配置模式的特殊文件,这在您描述的场景中不能使用它们。

1

是的,这就是configSource的用途,但配置部分可以具有内容或configSource属性,而不是两者。

0

您可以通过使用file属性,而不是configSource实现这种方法:

在你的榜样,你应该有文件App.Config

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
    <appSettings configSource="AppSett.config"> 
    <add key="test1" value="test2"/> 
    </appSettings> 
</configuration> 

AppSett.config

<?xml version="1.0" encoding="utf-8" ?> 
<appSettings> 
    <add key="test3" value="test3"></add> 
</appSettings> 
相关问题