473,395 Members | 1,869 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

AppSettings problem

We have a DLL that we're testing with NUnit (from GotDotNet). We want to
put some configuration information for the DLL into app.config in the
appSettings section. For some reason our settings are not being picked up.
We placed the appropriate XML tags in nunit-gui.exe.config (since NUnit is
loading our DLL), but ConfigurationSettings.AppSettings("ourTag") always
returns null.

Does anyone have any thoughts on why this is happening?

Is there a good tutorial that explains the details of .config files and how
the correct one is selected at runtime?

Thanks,

Eric

Nov 15 '05 #1
2 2583
>We have a DLL that we're testing with NUnit (from GotDotNet). We want to
put some configuration information for the DLL into app.config in the
appSettings section. For some reason our settings are not being picked up.
We placed the appropriate XML tags in nunit-gui.exe.config (since NUnit is
loading our DLL), but ConfigurationSettings.AppSettings("ourTag") always
returns null.
Does anyone have any thoughts on why this is happening?


Well, the basic out-of-the-box configuration support only extends to
applications as EXE's - it will pick up a "myapp.exe.config" file and
return values from it, but it WILL NOT look at a "mylib.dll.config"
file.

For that, you'd have to look elsewhere - there are a number of
third-party extensions / custom config readers that allow you to
specify the name of the config file to use.

Have a look here:
http://www.codeproject.com/csharp/Cu...ile_Reader.asp

and look around for other articles on CodeProject - excellent stuff.

Marc
================================================== ==============
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
Nov 15 '05 #2
Thanks, just the info we are looking for.

Eric

"Marc Scheuner [MVP ADSI]" <m.********@inova.SPAMBEGONE.ch> wrote in message
news:ct********************************@4ax.com...
We have a DLL that we're testing with NUnit (from GotDotNet). We want to
put some configuration information for the DLL into app.config in the
appSettings section. For some reason our settings are not being picked up.We placed the appropriate XML tags in nunit-gui.exe.config (since NUnit isloading our DLL), but ConfigurationSettings.AppSettings("ourTag") always
returns null.
Does anyone have any thoughts on why this is happening?


Well, the basic out-of-the-box configuration support only extends to
applications as EXE's - it will pick up a "myapp.exe.config" file and
return values from it, but it WILL NOT look at a "mylib.dll.config"
file.

For that, you'd have to look elsewhere - there are a number of
third-party extensions / custom config readers that allow you to
specify the name of the config file to use.

Have a look here:
http://www.codeproject.com/csharp/Cu...ile_Reader.asp

and look around for other articles on CodeProject - excellent stuff.

Marc
================================================== ==============
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch


Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Keith Chadwick | last post by:
I have 3 individual ASP.NET applications that make up the overall web application. Each of these websites share some common styles, scripts and xslt files. These are all placed in a single...
2
by: hazz | last post by:
I have spent more time than I care to admit trying to track down a very subtle error. Here is my app's xx.exe.config file. <?xml version="1.0" encoding="utf-8" ?> <configuration>...
3
by: jason | last post by:
i am coding a simple console application with Visual C# .NET in Visual Studio .NET my config file (myapp.exe.config) has the following appSettings section: <appSettings> <add key="myKey"...
4
by: Robert Pfeffer | last post by:
Hi, I have a rather unusual problem. I have a very simple ASP.NET application, basically hello world type. I created it with Visual Studio 2003 and am running it in debug mode. It runs fine...
2
by: Jared Hagel | last post by:
I've searched the web for a solution to this problem. Surprisingly, no problem/solution has been posted yet. We can read application configuration information fine when our asp.net application...
4
by: Dr. Paul Caesar - CoullByte (UK) Limited | last post by:
We have a contact us page that is used throughout our sites. I have over the last few days modified all sites to obtain information from Application Settings. It is a simple form that when ran...
5
by: Simon Hart | last post by:
Hi, I want to use the ConfigurationSettings.AppSettings from within a .NET class library that gets called. If using the above class, what would the name of the config file be? would this be the...
7
by: moondaddy | last post by:
I'm running a wpf windows app and want to add the appSettings element to the config file. when I do, the app wont start up and I get the following error: {"The type initializer for...
1
by: Ken | last post by:
I'm currently using 1.1. Is there any way using the value of a ConfigurationSettings.AppSettings as a key of ConfigurationSettings.AppSettings.Tosting( )]? for example in web.config <add...
6
by: Nick | last post by:
Hi there, I have a Windows Service application that has a load of settings defined, I can access these using My.Settings. I would like to pass the NameValueCollection of the settings to...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.