I am trapped in to a misterious issue. The visual studio 2012 test project, whenever I am tring to run it, is loading configuration settings from machine.config but not from app.config.
-
have you tried to `
` the settings in your `app.config` http://stackoverflow.com/questions/2201242/override-machine-config-by-web-config – 3dd Jul 30 '15 at 08:14
2 Answers
What you are describing here is normal. The reason for this the test runner is an external application that is ran by visual studio when you run the tests. As such, the test runner has its own config file that you would have to modify to pull this off. Conversely, the machine.config applies to every .net process that runs on your machine, so those settings will come in to the test project.

- 6,798
- 1
- 24
- 51
-
yes I have modified the test runner's config file but even after that the connection string is coming only from machine.config and App.config connection string are not added – user1812749 Nov 26 '13 at 19:44
The problem in Visual Studio 2012 itself. To run tests by default it doesn't use your bin folder, it deploys assemblies to system folder.
So, your app.config doesn't work in this case. There are several solutions like copy your app.config
to this folder on post build event or use .runsettings File. But the simplest way is to update your Visual Studio.
This issue was fixed in Visual Studio 2012 Update 4 and Visual Studio 2013.

- 8,592
- 5
- 41
- 54