1

I plan to build a WinForms application that will contain among other controls a dropdown list containing the names of the servers my team supports.

I'm looking to the future and wondering what to do if we inherit more servers.

Can I create an updatable xml file and distribute that with the app and have my teammates update it when we inherit a new server?

Should I update/rebuild/redeploy the app every time?

3 Answers 3

2

You can use App.Config as mentioned by astander. For our Winapps we use the appsettings part of App.Config to point to a different Configuration files like Dev, QA, Prod config files to keep the main one simple and clear.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
 <appSettings file="Development.config"></appSettings>

No. You will not need to redeploy anything. Just update the Config files and ask the users to restart their app if you add anything new to the config file while they have an active session

6
  • And the file is called 'Development.Config'? It's not compiled right? And it must reside in the same directory as the actual application executable? Dec 10, 2009 at 20:03
  • Well,for Dev servers have the main App.Config point to "Development.Config". For QA, we modify the main one to point "QA.config"..so on and so forth. You are right, it is not compiled and it should reside in the exe project.
    – SKG
    Dec 10, 2009 at 20:07
  • So if we get a new server and it needs to be added to my app's ddl, and a teammate of mine who installed my app last year needs to see that server in the ddl of his copy of the app, he just needs to look in his application's directory folder, open 'whatever.config' in a text editor, update it with the new server name and save it? Dec 10, 2009 at 20:12
  • Yes, provided the logic to read the list existed in your teammates exe.
    – SKG
    Dec 10, 2009 at 20:20
  • 1
    Conceptually, it is the same as reading from any flat file. One of the benefits is it is centralized and you can use ConfigurationManager Class to access the values.
    – SKG
    Dec 10, 2009 at 20:22
2

App.Config will be your friend

have a look at How to read and write settings to App.config

and also

Read/Write App.Config File with .NET

0

For a WinForms application, you could use a .settings file. You can then access the configuration elements using Properties namespace in your application. If you're in a Class Library project (or any other non-Forms project), you'll need to go in the project's configuration, in the settings tabl, to add the first .settings file that will allow the Properties namespace to appear for this project. For Forms project, a .settings file is automatically created in the Properties folder.

Here's the documentation about this :

http://msdn.microsoft.com/en-us/library/aa730869%28VS.80%29.aspx

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.