Reputation: 3040
I have an ASP.Net Core Web API application with unit tests built using xUnit. I am currently using the .Net Core 2.1.4 SDK and have the Microsoft.AspNetCore.All
nuget package installed in both the Web API and xUnit project. I am able to build and run the Web API and the tests just fine on my local machine.
The application builds just fine in Azure Devops, however I cannot get the tests to run.
I am running the tests on Azure Devops using the Dotnet Test
command. I have the step configured like so:
After the step sucessfully builds the tests project, I get the error:
The specified framework 'Microsoft.AspNetCore.All', version '2.1.4' was not found. Test Run Aborted
Additionally the console tells me the following versions of Microsoft.AspNetCore.All
are installed:
2.1.0
2.1.1
2.1.2
Do I need to set something up in Azure Devops that specifies which version of .Net Core my project requires? If that is the case, why is the Web API/test project able to build even though they require 2.1.4?
Upvotes: 4
Views: 2416
Reputation: 1829
Try by run it as "Visual Studio Test" instead and in the "Test files" box add two rows for xUnit.
**\bin\$(BuildConfiguration)\**\*test*.dll
!**\obj\**
!**\bin\$(BuildConfiguration)\**\xunit.runner.visualstudio.testadapter.dll
!**\bin\$(BuildConfiguration)\**\xunit.runner.visualstudio.dotnetcore.testadapter.dll
It's working good for me.
Otherwise take a look on Shinigami'a tutorial in: https://blog.bitscry.com/2019/03/21/running-xunit-tests-in-azure-devops/ but his "Test files" paths did not work for me.
Upvotes: 1