Solved

Best way to store configuration details?

Posted on 2008-11-03
7
901 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
Comment Utility
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
Comment Utility
0
 

Author Comment

by:kurb
Comment Utility
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 to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
i hope it worked for you and if still not then let us know
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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.   …
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

763 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

10 Experts available now in Live!

Get 1:1 Help Now