I am working in Visual Studio 2010 there I have a main project and two other library projects and there reference is added to main project. Every project is having a settings file. After building solution there comes only one .config file for main project but there is no .config file for library projects. Due to this I can not change the settings of those library project externally.
So what will be the solution of this problem that I can have .config files of library projects into my debug/release folder?
app.config
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="Communicator.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<section name="DatabaseManager.Database.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<applicationSettings>
<Communicator.Properties.Settings>
<setting name="ApplicationConfigsDirectory" serializeAs="String">
<value>\Application_Configs</value>
</setting>
<setting name="MaxMeterConn" serializeAs="String">
<value>10000</value>
</setting>
<setting name="MaxPhyConn" serializeAs="String">
<value>20000</value>
</setting>
<setting name="ServerIP" serializeAs="String">
<value>0.0.0.0</value>
</setting>
<setting name="Port" serializeAs="String">
<value>1114</value>
</setting>
<setting name="TCPTimeOut" serializeAs="String">
<value>3900000000</value>
</setting>
<setting name="isTCPTimeOut" serializeAs="String">
<value>True</value>
</setting>
<setting name="SchedulerPoolingTime" serializeAs="String">
<value>480000</value>
</setting>
<setting name="startKAScheduler" serializeAs="String">
<value>True</value>
</setting>
<setting name="MinCacheAge" serializeAs="String">
<value>00:02:00</value>
</setting>
<setting name="MaxCahceAge" serializeAs="String">
<value>00:05:00</value>
</setting>
<setting name="SaveLogToDBFlag" serializeAs="String">
<value>True</value>
</setting>
<setting name="Instance" serializeAs="String">
<value>MDC_Tester</value>
</setting>
</Communicator.Properties.Settings>
<DatabaseManager.Database.Properties.Settings>
<Setting Name="Server" Type="System.String" Scope="Application">
<Value Profile="(Default)">192.168.30.181</Value>
</Setting>
<Setting Name="Database" Type="System.String" Scope="Application">
<Value Profile="(Default)">tester</Value>
</Setting>
<Setting Name="UserID" Type="System.String" Scope="Application">
<Value Profile="(Default)">root</Value>
</Setting>
<Setting Name="pswd" Type="System.String" Scope="Application">
<Value Profile="(Default)">nothing</Value>
</Setting>
<Setting Name="MaxPoolSize" Type="System.Int32" Scope="Application">
<Value Profile="(Default)">512</Value>
</Setting>
</DatabaseManager.Database.Properties.Settings>
</applicationSettings>
<system.runtime.caching>
<memoryCache>
<namedCaches>
<add name="default"
cacheMemoryLimitMegabytes="1024"
pollingInterval="00:01:30" />
</namedCaches>
</memoryCache>
</system.runtime.caching>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>
</configuration>
This is the intended behaviour of settings and config files. You will need to copy the config sections from your library projects into the main project. You will also need to add the corresponding section elements to the applicationSettings section group:
then later in the main config:
In the above, the “SomeLibrary” settings type is declared in the main project and settings relating to the library are then set in the main config file alongside the settings for the main project.