Search code examples
c#.netvisual-studiounit-testingapp-config

C# app.config keys when running unit tests


I've spent about an hour on this. I have an app.config that's in a unit test project. When I compile/build it, it ends up in the bin folder with everything else. However, when I run said unit tests, the app.config, in the bin folder changes with a different set of keys. I'm baffled how this is happening, especially since 2 other developers don't have this issue. I've even re-cloned my local repo and still getting the same results. Are there config settings I'm not thinking of?


Solution

  • I figured it out, our solution had a hierarchy for app.configs. It was a custom setting I wasn't aware of that I had to dig in to find. Depending on the environment, you project/app.config could get overridden by any number of other ones from other app.config in the solution. I've seen this done with web.configs but never with an app.config.