构建失败-TFS2008上的VS2010解决方案 [英] Build failing - VS2010 solution on TFS2008

查看:82
本文介绍了构建失败-TFS2008上的VS2010解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将VS2008 ASP.NET MVC解决方案迁移到VS2010/MVC2/.NET 4.0.该解决方案在本地构建,并且所有单元测试均通过.

I have migrated a VS2008 ASP.NET MVC solution to VS2010/MVC2/.NET 4.0 The solution builds locally and all unit tests pass.

我们的TFS服务器仍为TFS2008,我无法通过CI构建.

Our TFS server is still TFS2008 and I am having problems getting the CI build to pass.

项目全部成功构建,单元测试全部运行并通过,但运行测试"项失败.

The projects all build successfully, the unit tests all run and pass but the Running Tests item fails.

我关注了此博客文章关于如何进行构建的工作,我快到了.

I followed this blog post on how to get the build working and I'm almost there.

在日志文件中查找故障,我发现了以下内容:

Combing the log file for failures I have found the following:

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.

即使我在tfsbuild.proj中指定了ToolsVersion ="4.0"并在生成服务器上的TfsBuildService.exe.config中更改了MSBuildPath,它似​​乎仍试图使用2008 MSTest工具.

It looks like it's trying to use the 2008 MSTest tool even though I have specified ToolsVersion="4.0" in the tfsbuild.proj and changed the MSBuildPath in the TfsBuildService.exe.config on the build server.

有人能指出我正确的方向来使它成功构建吗?

Can anyone point me in the right direction to get this to build successfully?

非常感谢, 尼克

添加tfsbuild.proj文件

Adding tfsbuild.proj file

<?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>

推荐答案

您必须在"C:\ Program Files(x86)\ MSBuild \ Microsoft \ VisualStudio \ TeamBuild \ Microsoft.TeamFoundation.Build.targets中打开配置文件",

You have to open the configuration file in "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets",

删除以下2个条目:

<UsingTask TaskName="Microsoft.TeamFoundation.Build.Tasks.TestToolsTask"...

<UsingTaskTaskName="TestToolsTask"...

并添加以下条目(将替换之前的条目并强制使用MSTest v10.0):

and add the following entry (which will replace the previous entries and force to use MSTest v10.0):

<UsingTaskTaskName="Microsoft.TeamFoundation.Build.Tasks.TestToolsTask"
       AssemblyFile="C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\Microsoft.TeamFoundation.Build.ProcessComponents.dll"
        Condition=" '$(ProjectFileVersion)' == '2' />

这对我有用

欢呼

这篇关于构建失败-TFS2008上的VS2010解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆