Bharat Jangir
Bharat Jangir

Reputation: 470

Custom configuration file for different solution projects

I have more than one solution projects for an application with using one app.config for each solution.

Can i do a separate configuration file (other than app.config) for common setting like db name (connection string) ? Because currently i put these setting in each and every app.config file.

Upvotes: 0

Views: 255

Answers (1)

mit
mit

Reputation: 1831

Please try following.

  1. Create one config called "common.config" like below which will be common to all solutions and let's say it's located @ "E:/myconfig". Please keep all common setting in this config.

    <appSettings> <add key="connstring" value="conn string value" /> </appSettings>

  2. Now link this common config in you specific solution config lets say web.config using file attribute

    <configuration>

    <appSettings file="E:\myconfig\Common.config"> <add key="key1" value="value" />

    </appSettings>

</configuration>

Hope this will work for you.

Upvotes: 1

Related Questions