简体   繁体   English

Visual Studio 2010和TFS 2008:构建单元测试项目

[英]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. 我们目前正在将VS2010用于测试驱动器,到目前为止,我们对它如何不与我们现有的Team Foundation Server 2008合作感到有点困惑。我们仍然拥有.NET 3.5上的所有项目以及我们现在正在构建解决方案它包含一个单元测试项目(自动在.NET 4.0中构建),TFS不会构建它。

The .NET 4.0 framework is installed on the TFS 2008. .NET 4.0框架安装在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. 作为临时解决方法,我们现在被迫删除所有测试项目,以便构建我们的解决方案。

您需要在构建计算机上安装VS2010。

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: 我刚刚尝试在TFS2008上构建V4.0解决方案,并更改了C:\\ Program Files \\ Microsoft Visual Studio 9.0 \\ Common7 \\ IDE \\ PrivateAssemblies \\ tfsbuildservice.exe.config文件:

<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. v3.5和v4.0解决方案的构建确实成功了。 But the unittest of the v3.5 solutions did not work. 但是v3.5解决方案的单元测试不起作用。

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. 阅读有关在构建服务器上安装VS2010的信息,但请阅读其他地方:( http://www.richard-banks.org/2009/11/how-to-build-vs2010-solutions-using.html )可以没有安装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: 这对我们有用,允许TFS 2008构建代理编译VS 2010解决方案/项目文件而无需安装VS 2010:

  1. Install .NET Framework 4.0 and .NET Framework 3.51 SP1 (for some reason, SP1 wasn't included with 4.0?) 安装.NET Framework 4.0和.NET Framework 3.51 SP1(出于某种原因,4.0不包含SP1?)
  2. Install Windows SDK 7.0A. 安装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. 当我写这篇文章时,SDK仍然没有发布,所以我们不得不:从安装了VS 2010的计算机上,从%programfiles%\\ Microsoft SDKs \\ Windows \\ v7.0A复制SDK文件夹,从HKLM \\ SOFTWARE \\复制注册表设置Microsoft \\ Microsoft SDKs \\ Windows \\ 7.0A到构建机器。
  3. Copy %programfiles%\\MSBuild\\Microsoft\\VisualStudio\\v10.0 to the build machine 将%programfiles%\\ MSBuild \\ Microsoft \\ VisualStudio \\ v10.0复制到构建计算机
  4. Change ToolsVersion from 3.5 to 4.0 in your TFSbuild.proj file. 在TFSbuild.proj文件中将ToolsVersion从3.5更改为4.0。

I think that was all. 我想这就是全部。 There was no need to change the build agent's configuration file. 无需更改构建代理的配置文件。


Hopefully this will work. 希望这会奏效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM