Solved

Best way to store configuration details?

Posted on 2008-11-03
7
902 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 69

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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 69

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

920 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now