p.campbell
p.campbell

Reputation: 100667

Assembly's App.Config is being ignored; Machine.config being read instead

In running my VS2008 unit integration tests against my DAL, I have found that the assembly is reading machine.config instead of the assembly's app.config.

Here's the rundown on the call stack:

Any help is appreciated!

Upvotes: 1

Views: 4881

Answers (2)

Roman
Roman

Reputation: 581

This might help to some people dealing with Settings.settings and App.config:

Watch out for GenerateDefaultValueInCode attribute in the Properties pane while editing any of the value (rows) in the Settings.settings grid in Visual Studio (VS2008 in my case).

If you set GenerateDefaultValueInCode to True (True is the default here!), the default value is compiled into the exe (or dll), you can find it embedded in the file when you open it in a plain text editor.

I was working on a console application and if I had defaults in the exe, the application always ignored the config file placed in the same directory!

Quite a nightmare and no information about this on the whole internet.

Upvotes: 2

Ray
Ray

Reputation: 46605

Not sure if this applies to you, but you need to make sure the configuration string is in your Unit Test Project's app.config, not your DataLayer project.

Upvotes: 5

Related Questions