0

I am trying to set up a build definition on tfs for .NET core which includes a test step with XUnit. Everything works fine until my tests pass, and then for some reason, the build fails immediately after.

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 :

That's it, no other detail. I am confused where to go from here, the test step is currently the last one in the build definition.

EDIT

This is the verbose output obtained by setting 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 : 
nagrom97
  • 494
  • 1
  • 6
  • 23

2 Answers2

0

Try following bellow items:

  • Open the project file (eg *.csproj) comment out below snippet:

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

  • Create a new build definition with ASP.NET Core (.NET Framework) template used.

Also reference this thread : VSTS build: Packages failed to restore - Unable to resolve 'NETStandard.Library (>= 1.6.1)' for '.NETStandard,Version=v2.0'

Andy Li-MSFT
  • 28,712
  • 2
  • 33
  • 55
0

So I fixed the issue by modifying the csproj file in the test project and adding a cli tool reference like so

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

In the build process on TFS, I removed the Dotnet test step and added in its place a command line step and configured it as I did below. Everything works now and the build is successful.

Command line step

Step detail

nagrom97
  • 494
  • 1
  • 6
  • 23