my continuous integration server (TeamCity) is configured to run all the unit tests in our app on build. Prior to running those tests, i need to change some of the appSettings to make them valid for our CI server. I'm achieving something similar for my web project by using the deployment project provided with Visual Studio. Can i do the same for a Test project?
Thanks, Gonzalo
I have created a Visual Studio add in which can be used to transform app.config in the same way that web.config is transformed. You can find the add-in, SlowCheetah, at http://visualstudiogallery.msdn.microsoft.com/69023d00-a4f9-4a34-a6cd-7e854ba318b5.
I have posted a blog about how to get this working on a build server as well.
It's possible to use Web.config Transformations for App.config files through a workaround.
You simply have to invoke the appropriate MSBuild tasks at the right stage in your build process.
Add this code snippet to your project file:
Then add additional App.config files to your project for each build configuration where you wish to apply a transformation. For example:
Related resources:
I suggest that you wrap your config lookups, extract an interface and stub this when testing.