by Njål

Unit testing – Visual Studio 2012 Fakes in Team City


TeamCity only supports the MsTest testrunner for running MS Tests. This testrunner does not support the brilliant Fakes Framework.


If you run the tests with MsTest – you’ll get the legendary ShimNotSupportedException – which you can read more about here.

The Visual Studio 2012 Test Runner however supports Fakes – here’s how to make Team City use this runner instead of MsTest:



“C:Program Files (x86)Microsoft Visual Studio 11.0Common7IDECommonExtensionsMicrosoftTestWindowvstest.console.exe” /inIsolation UnitTest.dll


Note that this requires Visual Studio 2012 on the Build Agent machine. I know a lot of you don’t like this – so you can also just copy the files in the TestWindow folder to your Build Agent and use vstest.console.exe directly.

Another thing which is nice is that the VSTest is a lot faster than MsTest.

  • Mark

    Do you know if there is a way to get the nunit test adapter to install without having to install Visual Studio? I am trying to set TeamCity to use the vstest runner so that I can execute against the fakes framework, but I use nunit instead of mstest and I cannot seem to get vstest.console to recognize nunit tests.

  • Pingback: Microsoft Fakes: The solution to our .Net testing woes? (NUnit) | Return Null()

  • Gabriel

    Do you know how to get it to work with dotCover in TeamCity