app.config file mix up for .net app

I have a solution with 4 projects within that all interact with each other. Each project contains its own app.config file named as 'app.config' and may at times contain the same appsettings fields. however for some reason when calling one project.method from another, when it initializes, it calls the app.config file from the calling project method. This should not be the case since I know that each project is compiled with its own config file.

 o = streamSettings.GetValue("ConnectionString", GetType(String))
    connectionString = o.ToString()

    o = streamSettings.GetValue("LogFileDirectory", GetType(String))
    logFileDirectory = o.ToString()

This is the same for the all projects but I am getting the wrong connection string here.


Are any of the projects DLL's by chance.

.NET's config system associates the APP.CONFIG file with a PROCESS, not a executable image.

So, say you have a solution with ProjectA (an EXE) and project b (a DLL).

Project A references Project B and calls into project B.

In Project A, calls to config methods will pull from Project A's App.config.

Once Project A calls into Project b, the code in Project B will also end up refering to Project A's config file, just looking into the sections defined in Project B.

it's weird and pretty unweildy, but that appears to be intentional

There are some articles out on the web though about how to setup a DLL so that it reads from it's OWN configuration file.

Here's one from SO itself

C# Dll config file

Need Your Help

Sending Activity to background with out finishing

android android-activity

How can I make an activity go to background without calling its finish() method and return to the Parent activity that started this? I tried so much but I could not find a solution. So if you guys ...

SimpleInjector Verification - is it possible to mark warnings as acceptable to make *new* items obvious?

c# dependency-injection inversion-of-control simple-injector

The SimpleInjector verification feature from time to time has highlighted issues that I have needed to fix. I do however have a couple of "potential" issues that I am comfortable with and I would l...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.