Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

app.config How to use them?

app.config How to use them?

app.config How to use them?

I have "SimpleClient.exe".  I created an application configuration file "app.config"(see code below)to point SimpleClient to a new version of "Simple.dll"  which is in the GAC. Should "app.config" be in the same directory or the root perhaps? When I run "SimpleClient.exe" MS wants to send an error report. Hope I didn't hose the GAC. Thanks.

<?xml version="1.0" encoding="utf-8" ?>
    <assemblyBinding     xmlns="urn:schemas-microsoft-com:asm.v1">
        <assemblyIdentity name="Simple"
                          culture="neutral" />
        <bindingRedirect oldVersion=""

RE: app.config How to use them?

typically, you would create a section under configuration called appSettings and add a key with a value.

      <add key="SimpleLocation" value="C:\Simple.dll" />

Then from your code you would say

using System.Configuration;

public string GetSimpleLocation()
   return ConfigurationSettings.AppSettings["SimpleLocation"].ToString();

RE: app.config How to use them?

app.config files work well enough, but they're read-only.

If you have a need to write to a configuration file, I like NIni, which is available on Sourceforge.  It uses INI files instead of xml .config files, which are easier for many people to edit by hand.

Chip H.

If you want to get the best response to a question, please read FAQ222-2244 first

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close