views:

202

answers:

1

In vs team system 2008 unit test, how can i load an application configuration file in the test itself?

i have an app.config in the test project, referenced System.Configuration but when running the test, it doesn't see the app.config

A: 

Have a pre-build batch event that copies it across from your app directory.

You can add this by right clicking on your test project (or the app) and clicking Properties. When the page opens select "Build Events" from the menu and enter your command e.g:

xcopy ../app.config ../../Test/bin/app.config

Or maintain a copy yourself.

Rob Stevenson-Leggett