Azure devops tests fail with very little clue

I updated some references in my Azure Devops build and got the following error in the unit testing task:

...
##[error]Error: The process '/opt/hostedtoolcache/dotnet/dotnet' failed with exit code 1 
Result Attachments will be stored in LogStore 
Run Attachments will be stored in LogStore 
No Result Found to Publish '/home/vsts/work/_temp/_fv-az101-233_2021-09-09_10_21_12.trx'. 
No Result Found to Publish '/home/vsts/work/_temp/_fv-az101-233_2021-09-09_10_21_17.trx'. 
No Result Found to Publish '/home/vsts/work/_temp/_fv-az101-233_2021-09-09_10_21_24.trx'. 

##[warning].NET 5 has some compatibility issues with older Nuget versions(<=5.7), so if you are using an older Nuget version(and not dotnet cli) to restore, then the dotnet cli commands (e.g. dotnet build) which rely on such restored packages might fail. To mitigate such error, you can either: (1) - Use dotnet cli to restore, (2) - Use Nuget version 5.8 to restore, (3) - Use global.json using an older sdk version(<=3) to build 
Info: Azure Pipelines hosted agents have been updated and now contain .Net 5.x SDK/Runtime along with the older .Net Core version which are currently lts. Unless you have locked down a SDK version for your project(s), 5.x SDK might be picked up which might have breaking behavior as compared to previous versions. You can learn more about the breaking changes here: https://docs.microsoft.com/en-us/dotnet/core/tools/ and https://docs.microsoft.com/en-us/dotnet/core/compatibility/ . To learn about more such changes and troubleshoot, refer here: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting 

##[error]Dotnet command failed with non-zero exit code on the following projects : 
Async Command Start: 
Publish test results Publishing test results to test run '1136330'.
...

Especially the last, “Dotnet command failed … on the following projects” does not give the clue I am looking for. What failed?

To cut a long story short: One of my test project lacked reference to Microsoft.NET.Test.Sdk.

A longer story is that I updated from xunit.runner.visualstudio from 2.4.1 to 2.4.3 and it doesn’t have a reference to the Microsoft.Net.Test.Sdk project as it is no longer Visual studio that holds the reference but the project itself. The clues I got were from https://github.com/xunit/visualstudio.xunit/issues/219 and https://github.com/xunit/visualstudio.xunit/issues/259 in no special order.

Leave a Reply