【问题标题】:TFS Build fails after successful test run成功测试运行后 TFS 构建失败
【发布时间】:2018-03-31 06:40:46
【问题描述】:

我正在尝试在 .NET 核心的 tfs 上设置构建定义,其中包括使用 XUnit 的测试步骤。一切正常,直到我的测试通过,然后由于某种原因,构建立即失败。

Total tests: 2. Passed: 2. Failed: 0. Skipped: 0.
Test Run Successful.
Test execution time: 3.3499 Seconds
Error: d:\a\_tool\dncs\2.0.0\x64\dotnet.exe failed with return code: 1
Dotnet command failed with non-zero exit code on the following projects :

就是这样,没有其他细节。我很困惑从这里去哪里,测试步骤目前是构建定义中的最后一个。

编辑

这是通过设置 debug = true 得到的详细输出

2017-10-19T09:50:00.4882598Z ##[debug]rc:1
2017-10-19T09:50:00.4902607Z ##[debug]success:false
2017-10-19T09:50:00.5002614Z ##[error]Error: 
d:\a\_tool\dncs\2.0.0\x64\dotnet.exe failed with return code: 1
2017-10-19T09:50:00.5002614Z ##[debug]Processed: ##vso[task.issue 
type=error;]Error: d:\a\_tool\dncs\2.0.0\x64\dotnet.exe failed with return 
code: 1
2017-10-19T09:50:00.5022599Z ##[debug]task result: Failed
2017-10-19T09:50:00.5032599Z ##[error]Dotnet command failed with non-zero 
exit code on the following projects : 
2017-10-19T09:50:00.5032599Z ##[debug]Processed: ##vso[task.issue 
type=error;]Dotnet command failed with non-zero exit code on the following 
projects : 
2017-10-19T09:50:00.5042604Z ##[debug]Processed: ##vso[task.complete 
result=Failed;]Dotnet command failed with non-zero exit code on the 
following projects : 

【问题讨论】:

  • 能否请您设置debug=true,然后在此处获取并分享日志以进行故障排除?
  • 我这样做了,但不幸的是,冗长的输出同样没用,我会在这里为您更新。

标签: tfs continuous-integration azure-devops


【解决方案1】:

尝试以下项目:

  • 打开项目文件(例如*.csproj)在sn-p下面注释掉:

    <DotNetCliToolReference Include="BundlerMinifier.Core" Version="X.X.XXX" />

  • 使用ASP.NET Core (.NET Framework) 创建新的构建定义 使用的模板。

也参考这个帖子:VSTS build: Packages failed to restore - Unable to resolve 'NETStandard.Library (>= 1.6.1)' for '.NETStandard,Version=v2.0'

【讨论】:

  • 谢谢,但我的解决方案中的任何文件中都没有 sn-p
【解决方案2】:

所以我通过修改测试项目中的 csproj 文件并像这样添加 cli 工具引用来解决这个问题

  <ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0-preview-20170628-02" />
<PackageReference Include="Moq" Version="4.7.142" />
<PackageReference Include="MSTest.TestAdapter" Version="1.1.18" />
<PackageReference Include="MSTest.TestFramework" Version="1.1.18" />
<PackageReference Include="xunit" Version="2.3.0" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.0-beta2-build3683" /> <-- This bit here!!!
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.0" />
</ItemGroup>

在 TFS 上的构建过程中,我删除了 Dotnet 测试步骤,并在其位置添加了一个命令行步骤,并按照下面的方式对其进行了配置。现在一切正常,构建成功。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-09-23
    • 1970-01-01
    • 2013-05-17
    • 1970-01-01
    • 1970-01-01
    • 2018-11-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多