troubleshooting Question

How to read in application settings file in C# based on what environment the application is running from - Development, Test or Production

Avatar of Scott Gabel
Scott GabelFlag for United States of America asked on
C#
15 Comments3 Solutions307 ViewsLast Modified:
Hi Everyone,  

Our development team primarily develops Windows Form and Windows Service application using C# only.
We're trying to come up with a standard to use for all our applications when reading in settings from a settings file or app.config file.

The goal is to have our applications read in either Development, Test or Production settings based on what environment we deploy our application to.  How we determine the environment is based on what server the application is deployed to.  I'm just looking for some help from others on what's the most efficient way to do this and is there any industry standards we should use?  

For example, should we use just one app.config file with 3 different sets of variables in there or should we use 3 different settings files, one for DEV, TST and PRD?  When the application loads our goal is to read in the correct settings into our own class with properties that we can access throughout the application.

Any help would be greatly appreciated.  

Thank you so much.  
Scott Gabel
ASKER CERTIFIED SOLUTION
AndyAinscow
Freelance programmer / Consultant

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 3 Answers and 15 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 15 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros