I have this code to load a config file and read all the values and it works fine when running the application but of course fails on team city because the appdomain\'s base
I like to make my classes configurable - for example they get the folder name as a parameter in their constructor. This makes it possible to test with different config files.
In test code we use:
TestContext.TestDeploymentDir
This is the testrun folder, where all assemblies for a test run are copied into, together with the test deployment items. We 'deploy' our unit test config files to the test run folder - this can be specified in the testrunconfig dialog in visual studio.
For our production code we pass
Assembly.GetExecutingAssembly().Location
to the constructor, which works for us.