Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2010 and TFS 2008: Building unit test projects

We are currently taking VS2010 for a testdrive and so far we are a little stumped with how it just won't cooperate with our existing Team Foundation Server 2008. We still have all our projects on .NET 3.5 and whenever we are now building a solution that contains a unit test project (which automatically builds in .NET 4.0) the TFS won't build it.

The .NET 4.0 framework is installed on the TFS 2008.

The error we're receiving is:

[Any CPU/Release] c:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(0,0): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.

As a temporary workaround we are now forced to remove all our test projects in order for our solutions to build.

like image 824
Peter Avatar asked May 04 '10 07:05

Peter


2 Answers

You need to install VS2010 on your build machine.

like image 171
Darin Dimitrov Avatar answered Nov 16 '22 00:11

Darin Dimitrov


I'v just been trying to build V4.0 solutions on TFS2008, and altered the C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\tfsbuildservice.exe.config file:

<add key="MSBuildPath" value="" />

to

<add key="MSBuildPath" value="c:\Windows\Microsoft.NET\Framework\v4.0.30319\" />

The build of v3.5 and v4.0 solutions did succeed. But the unittest of the v3.5 solutions did not work.

Read about installing VS2010 on the build server, but read somewhere else: ( http://www.richard-banks.org/2009/11/how-to-build-vs2010-solutions-using.html ) that it is possible without installing VS2010.

: Text from that website:


This worked for us allowing a TFS 2008 build agent compile VS 2010 solution/project files without installing VS 2010:

  1. Install .NET Framework 4.0 and .NET Framework 3.51 SP1 (for some reason, SP1 wasn't included with 4.0?)
  2. Install Windows SDK 7.0A. When I'm writing this the SDK is still not released so we had to: From a computer with VS 2010 installed, copy the SDK folder from %programfiles%\Microsoft SDKs\Windows\v7.0A and registry settings from HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\7.0A to the build machine.
  3. Copy %programfiles%\MSBuild\Microsoft\VisualStudio\v10.0 to the build machine
  4. Change ToolsVersion from 3.5 to 4.0 in your TFSbuild.proj file.

I think that was all. There was no need to change the build agent's configuration file.


Hopefully this will work.

like image 39
Dennis Avatar answered Nov 16 '22 00:11

Dennis