2017-10-19 285 views
0

我正在尝试在包含XUnit测试步骤的.NET核心的tfs上设置构建定义。一切正常,直到我的测试通过,然后出于某种原因,构建失败后立即。成功测试运行后TFS构建失败

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 : 

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

编辑

这是通过设置调试获得详细输出=真正

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 : 
+0

能否请你设置'调试=真',然后拿到这里分享日志排除故障? –

+0

我这样做了,但不幸的是,详细的输出是无用的,我会在这里为你更新它。 – nagrom97

回答

0

所以我通过修改测试项目的csproj文件并添加一个命令行工具的参考,像这样

<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测试步骤,并在它的位置添加了一个命令行步骤,并按照以下步骤进行配置。现在一切正常,构建成功。

Command line step

Step detail

0

尝试以下波纹管项目:

  • 打开项目文件(例如:*.csproj)注释掉以下片段:

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

+0

谢谢,但该代码段不在我解决方案中的任何文件中 – nagrom97

相关问题