By default, in Visual Studio Team Test, a project’s App.config is not accessible from the unit test project. If you need access to it from your unit test, you can include a post-build event to rename it and add it to your unit test output directory. Follow these steps:
1. Right click on the unit test project
2. Select “Properties”
3. Select the “Build Events” tab
4. In the “Post-build event command line” text box, enter:
copy "<project path>App.config" "$(ProjectDir)$(OutDir)$(TargetFileName).config"
Where <project path> is the path to the location of the App.config. This can be a relative path such as:
copy "$(ProjectDir)../MyProject/App.config" "$(ProjectDir)$(OutDir)$(TargetFileName).config"
copy "<project path>App.config" "$(ProjectDir)$(OutDir)$(TargetFileName).config"
Where <project path> is the path to the location of the App.config. This can be a relative path such as:
copy "$(ProjectDir)../MyProject/App.config" "$(ProjectDir)$(OutDir)$(TargetFileName).config"
5. Save