我已将一个VS2008 ASP.NET MVC解决方案迁移到了VS2010/MVC2/.NET 4.0。该解决方案在本地构建成功,并且所有单元测试都通过了。
我们的TFS服务器仍然是TFS2008,我在尝试使CI构建通过时遇到了问题。
所有项目都可以成功构建,所有单元测试都可以运行并通过,但“Running Tests”项失败了。
我按照这篇博客文章中的步骤进行了操作,现在已经接近成功了。
在查找失败原因的日志文件中,我发现了以下内容:
我们的TFS服务器仍然是TFS2008,我在尝试使CI构建通过时遇到了问题。
所有项目都可以成功构建,所有单元测试都可以运行并通过,但“Running Tests”项失败了。
我按照这篇博客文章中的步骤进行了操作,现在已经接近成功了。
在查找失败原因的日志文件中,我发现了以下内容:
Test Run Completed.
Passed 1101
------------
Total 1101
Results file: C:\Documents and Settings\apptemetrybuild\Local Settings\Temp\Client Portal 3\CI\TestResults\apptemetrybuild_ATT15DEV01 2010-04-27 09_09_59_Any CPU_Release.trx
Test Settings: Default Test Settings
Waiting to publish...
Publishing results of test run apptemetrybuild@ATT15DEV01 2010-04-27 09:09:59_Any CPU_Release to http://att15tfs01:8080/...
.....Publish completed successfully.
Command:
D:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\MSTest.exe /nologo /searchpathroot:"C:\Documents and Settings\apptemetrybuild\Local Settings\Temp\Client Portal 3\CI\Binaries\Release" /resultsfileroot:"C:\Documents and Settings\apptemetrybuild\Local Settings\Temp\Client Portal 3\CI\TestResults" /testcontainer:"C:\Documents and Settings\apptemetrybuild\Local Settings\Temp\Client Portal 3\CI\Binaries\Release\\Attenda.Stargate.Security.Tests.dll" /publish:"http://att15tfs01:8080/" /publishbuild:"vstfs:///Build/Build/149" /teamproject:"Client Portal 3" /platform:"Any CPU" /flavor:"Release"
The "TestToolsTask" task is using "MSTest.exe" from "D:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\MSTest.exe".
Loading C:\Documents and Settings\apptemetrybuild\Local Settings\Temp\Client Portal 3\CI\Binaries\Release\\Attenda.Stargate.Security.Tests.dll...
C:\Documents and Settings\apptemetrybuild\Local Settings\Temp\Client Portal 3\CI\Binaries\Release\\Attenda.Stargate.Security.Tests.dll
Could not load file or assembly 'file:///C:\Documents and Settings\apptemetrybuild\Local Settings\Temp\Client Portal 3\CI\Binaries\Release\Attenda.Stargate.Security.Tests.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. MSBUILD : warning MSB6006: "MSTest.exe" exited with code 1. [C:\Documents and Settings\apptemetrybuild\Local Settings\Temp\Client Portal 3\CI\BuildType\TFSBuild.proj]
The previous error was converted to a warning because the task was called with ContinueOnError=true.
Build continuing because "ContinueOnError" on the task "TestToolsTask" is set to "true".
Done executing task "TestToolsTask" -- FAILED.
看起来它似乎在尝试使用2008 MSTest工具,即使我已经在tfsbuild.proj中指定了ToolsVersion="4.0"并在构建服务器上更改了TfsBuildService.exe.config中的MSBuildPath。
有人能指点我如何成功构建吗?
非常感谢, Nick
编辑:添加tfsbuild.proj文件
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="DesktopBuild" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<!-- Do not edit this -->
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets" />
<ProjectExtensions>
<!-- Team Foundation Build Version - DO NOT CHANGE -->
<ProjectFileVersion>3</ProjectFileVersion>
<Description></Description>
<BuildMachine>ATT15DEV01</BuildMachine>
</ProjectExtensions>
<PropertyGroup>
<TeamProject>Client Portal 3</TeamProject>
<BuildDirectoryPath>C:\Documents and Settings\nfoster\Local Settings\Temp\Client Portal 3\CI</BuildDirectoryPath>
<DropLocation>\\att15dev01\Builds\Client Portal 3</DropLocation>
<RunTest>true</RunTest>
<RunCodeAnalysis>Never</RunCodeAnalysis>
<WorkItemType>Bug</WorkItemType>
<WorkItemFieldValues>System.Description=Start the build using Team Build</WorkItemFieldValues>
<WorkItemTitle>Build failure in build:</WorkItemTitle>
<DescriptionText>This work item was created by Team Build on a build failure.</DescriptionText>
<BuildlogText>The build log file is at:</BuildlogText>
<ErrorWarningLogText>The errors/warnings log file is at:</ErrorWarningLogText>
<UpdateAssociatedWorkItems>true</UpdateAssociatedWorkItems>
<AdditionalVCOverrides></AdditionalVCOverrides>
<CustomPropertiesForClean></CustomPropertiesForClean>
<CustomPropertiesForBuild></CustomPropertiesForBuild>
</PropertyGroup>
<ItemGroup>
<!-- SOLUTIONS -->
<SolutionToBuild Include="$(BuildProjectFolderPath)/../../Trunk/Client Portal 3 CI Build.sln">
<Targets></Targets>
<Properties></Properties>
</SolutionToBuild>
</ItemGroup>
<ItemGroup>
<!-- CONFIGURATIONS -->
<ConfigurationToBuild Include="Release|Any CPU">
<FlavorToBuild>Release</FlavorToBuild>
<PlatformToBuild>Any CPU</PlatformToBuild>
</ConfigurationToBuild>
</ItemGroup>
<ItemGroup>
<!-- TEST ARGUMENTS -->
<TestContainer Include="$(OutDir)\%2aTests.dll" />
</ItemGroup>
<PropertyGroup>
<!-- TEST ARGUMENTS -->
<TestToolsTaskToolPath>C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe</TestToolsTaskToolPath>
</PropertyGroup>
<ItemGroup>
<!-- ADDITIONAL REFERENCE PATH -->
</ItemGroup>
<Target Name="AfterTest">
<GetBuildProperties TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
BuildUri="$(BuildUri)"
Condition=" '$(IsDesktopBuild)' != 'true' ">
<Output TaskParameter="TestSuccess" PropertyName="TestSuccess"/>
</GetBuildProperties>
<SetBuildProperties TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
BuildUri="$(BuildUri)"
CompilationStatus="Failed"
Condition=" '$(IsDesktopBuild)' != 'true' and '$(TestSuccess)' != 'true' ">
</SetBuildProperties>
</Target>
</Project>