App.config not reading key

G

Guest

I have a simple C# VS 2005 console application that contains a class and an
app.config file.

My app.config

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key = "KW_Geometry_CheckIn_Path" value="\\kwcyarm006
Batchplot\Input\Iput" />
<add key = "KW_Geometry_CheckOut_Path" value="yes" />
<add key = "PB_Geometry_CheckIn_Path"
value="\\PBCDEPM216\PBCDEP-Batchplot\input\IPut" />
<add key = "PB_Geometry_CheckOut_Path" value="yes" />
</appSettings>
</configuration>


I have included the reference to
using System.Configuration;
using System.Collections.Specialized;
using System.Collections.ObjectModel;
using System.Data;
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Xml;


My app code is:

string configpath =
ConfigurationManager.AppSettings.Get("KW_Geometry_CheckIn_Path");

This will compile but won't read the value and shows a null string. I tried
using the ConfigurationSettings.AppSettings but get a deprecated error. Can
someone help with the proper syntax to retrieve the value from the app.config?

Thanks


Tastes like burning
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top