问题描述
大家好,
我有一个配置文件(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. :)
推荐答案
<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. :)
这篇关于在App.config中指定另一个配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!