Solved

Best way to store configuration details?

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

810 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