I’ve recently started upgrading some of our projects to use Visual Studio 2010. As we use Team City as our continuous integration environment I had to install .NET 4.0 on the server as the Visual Studio msbuild (csproj and sln files are msbuild files) won’t build using .NET 3.5 or below correctly. Team city however can’t tell that you’ve upgraded, so you need to add an environment variable to each project you upgrade:
MSBuild set to %system.DotNetFramework4.0_x86_Path%
This does the trick (after much searching to find that), but once you’re done if you’re using nUnit then you’re in for another world of hurt. Team City 5 will support .NET 4.0 but not the version that comes with Visual Studio 2010 (at the time of writing). Visual Studio 2010 will install v4.0.30319 but nUnit will only work with up to v4.0.30128 (again at the time of writing, hopefully JetBrains release a new version soon).
You can TELL the dotNet plugin to work with the correct framework, it’s a pain in the ….. well it’s messy, but it works.
Open the <server>\webapps\root\update\plugins directory and copy down the dotnetPlugin.zip file. Unpack it and open the dotnetPlugin\bin directory. Open each file matching the wildcard JetBrains.TeamCity.PlatformProcessRunner.v4.0*.exe.config and modify the startup section to show the following:
<startup>
<supportedRuntime version="v4.0.20506"/>
<supportedRuntime version="v4.0.21006"/>
<supportedRuntime version="v4.0.30128"/>
<supportedRuntime version="v4.0.30319"/>
</startup>
You should probably already have the first three, I just had to add the last one. Once you’ve done this your code should work after you tell the nUnit team city plugin to use .Net 4.0 instead of 2.0.
<Exec Command="$(teamcity_dotnet_nunitlauncher) v4.0 x86 NUnit-2.4.8 Project.Tests\bin\$(Configuration)\Project.Tests.dll" />
Underlined above.
Both those bits of information were available on the net, but hard to find and both found seperately. Hopefully they help someone.