Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Best way to store configuration details?

Posted on 2008-11-03
7
904 Views
Last Modified: 2013-12-17
So I have a windows application (C# .NET VS2008) where i put my configuration values into Settings like so...(Solution's View -> Your Project name -> Properties -> settings.Settings - which seemed like the right thing to do.  But, what i was really looking for was a way to change application settings easily without needing to recompile and without having to put controls in to the application itself to allows them to be changed (the program runs silently and so putting controls in to allow changes to config values via the application itself is not really practical).  I was expecting to see something like a app.config file (like i see when i develop a web service) get written to the installation directory of the application after i install it (or perhaps it is there - but i just don't know where to look?)
0
Comment
Question by:kurb
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 4

Expert Comment

by:Makolyte
ID: 22868027
This article explains how to write/read to the app.config file: http://geekswithblogs.net/akraus1/articles/64871.aspx
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 22868095
0
 

Author Comment

by:kurb
ID: 22868873
Ok, so based on those articles, it sounds like i can not actually edit a config file outside of the application to change config values.  My options would be...  1. open the project, change the "settings" and rebuild.  2. provide a form in the application to allow a user to change these values.   Please correct me if i am wrong.  What i really want to know is, how do i change application config values OUTSIDE of the application (meaning without having to build it again and without having to provide an interface of some kind).  If there is a file i can edit - if so - where is it?  I see config files all over the place - which one will actually affect these values at run time?  (Sorry newbie here - you have talk slow an simple for me)
0
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 
LVL 70

Expert Comment

by:Éric Moreau
ID: 22869217
yes you can edit the values in those files. it is a XML file so open it with Notepad and do it.
0
 
LVL 26

Accepted Solution

by:
Anurag Thakur earned 100 total points
ID: 22869416
when you add settings in your file and then build and deploy your application and applicationname.exe.config file is also installed the bin folder
all your settings are part of that file and if you need to modify some setting then open the file in some editor and update the setting
you dont need to build the setup and deploy it agian if some setting changes
0
 

Author Comment

by:kurb
ID: 22869974
I figured out what was happening (now remember i said i was a newbie).  I was publishing my  application and then installing it from the setup.exe created.  This did some magical stuff that didn't produce what i had expected (which was a app.exe and an app..exe.config file).  Instead it produced some manifest files an d a file called app.exe.config.deploy.  So a friend told me to build a new "set up wizard" project and add it to my solution.  Doing this produced an msi installer, but this time, when i installed it, it made a app.exe and an app.exe.config file.  I could then opent the config xml and edit it directly as i wanted to.  I think the setup.exe created by the "publish" action is just doing some magic that i don't understand - i could not locate the config file after installing this way.
0
 
LVL 26

Expert Comment

by:Anurag Thakur
ID: 22873473
i hope it worked for you and if still not then let us know
0

Featured Post

The New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question