I'm trying to run unit test and code coverage on an ASP.NET MVC3 web appllication project. We're using MSpec for unit test and dotCover for coverage. All runs fine on Visual Studio 2010, but when TeamCity runs the build, I get an error with dotCover.
[18:45:56]Step 2/2: Unit Test (MSpec) (53s)
[18:45:56][Step 2/2] Starting: C:\BuildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher.exe #TeamCityImplicit
[18:45:56][Step 2/2] in directory: C:\BuildAgent\work\6a7ce7f61063ef77
[18:46:16][Step 2/2] JetBrains dotCover Console Runner v1.2.352.19. Copyright (c) 2009-2012 JetBrains s.r.o. All rights reserved.
[18:46:40][Step 2/2] Coverage session started [07/04/2012 18:46:42]
[18:46:43][Step 2/2] Could not load file or assembly 'file:///C:\BuildAgent\work\6a7ce7f61063ef77\xxxxx.PublicWeb.Specifications\bin\Release\xxxx.PublicWeb.Specifications.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
[18:46:49][Step 2/2] Coverage session finished [07/04/2012 18:46:50]
[18:46:49][Step 2/2] Analysed application exited with code '-1'
[18:46:49][Step 2/2] Coverage results post-processing started [07/04/2012 18:46:50]
[18:46:49][Step 2/2] Coverage results post-processing finished [07/04/2012 18:46:51]
[18:46:50][Step 2/2] ##teamcity[importData type='dotNetCoverage' tool='dotcover' file='C:\BuildAgent\temp\buildTmp\tmp9BE6.tmp']
[18:46:50][Step 2/2] Importing data from 'C:\BuildAgent\temp\buildTmp\tmp9BE6.tmp' with 'dotNetCoverage' processor
[18:46:50][Step 2/2] Process exited with code -3
[18:46:50][Step 2/2] Step Unit Test (MSpec) failed
Now, this all works fine when run in Visual Studio. However, I tried changing my projects to target .net 3.5 just in case that is the problem. I then get errors because MVC3 requires .NET 4. This makes it kind of difficult to do coverage on an MVC3 application. Any ideas?