在App.config中指定另一个配置文件 [英] Specify another config file in App.config

查看:120
本文介绍了在App.config中指定另一个配置文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个配置文件(App.config)的应用程序(myApp.exe).
在"App.config"中的一行类似于以下内容:

hi guys,

I have an application(myApp.exe) that has a config file(App.config).
Inside "App.config" is a line similar below:

<appsettings>
     <add key="ConfigPath" value="LoggingBlock.config" />
</appsettings>



"LoggingBlock.config"将包含"myApp.exe"的日志设置.
如果主要由"myApp.exe"使用的配置文件是"App.config",当需要记录日志时,如何让"myApp.exe"引用"LoggingBlock.config"?有可能吗?

香港专业教育学院搜索过网络,但似乎没有一个与我的问题相同. :(

任何帮助都将不胜感激.

谢谢. :)



"LoggingBlock.config" will contain the log settings of "myApp.exe".
How do I let "myApp.exe" refer to "LoggingBlock.config" when logging is needed if the config file mainly used by "myApp.exe" is "App.config"? Is it possible?

Ive searched the net but none seem to have the same issue as mine. :(

Any kind of help is much appreciated.

Thanks. :)

推荐答案

我更改了App.config的内容.现在包含:

I changed the content of App.config. It now contains :

<enterpriselibrary.configurationsource selectedsource="File-based Configuration Source">
     <sources>
          <add name="File-based Configuration Source" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
          filePath="C:\LoggingBlock.config" />
      </add></sources>
</enterpriselibrary.configurationsource>



该应用程序未做任何更改. :)



Nothing was changed in the application. :)


ConfigManager.Net-App.config和Web.config帮助器实用程序 [^ ]


这篇关于在App.config中指定另一个配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆