Base solution for your next web application
Open Closed

Errors running Unit Tests in Azure Pipeline #7911


User avatar
0
dmux created

My unit tests all work in Visual Studio, but I get errors in the Azure pipeline.

This is the error with some possible clues in the preceeding lines:

Test run will use DLL(s) built for framework .NETCoreApp,Version=v2.2 and platform X86. Following DLL(s) do not match framework/platform settings. xunit.runner.visualstudio.dotnetcore.testadapter.dll is built for Framework 1.0 and Platform AnyCPU. xunit.runner.visualstudio.dotnetcore.testadapter.dll is built for Framework 1.0 and Platform AnyCPU. xunit.runner.visualstudio.dotnetcore.testadapter.dll is built for Framework 1.0 and Platform AnyCPU. Go to http://go.microsoft.com/fwlink/?LinkID=236877&clcid=0x409 for more details on managing these settings. ##[error]Unable to find d:\a\1\s\test\DMux.WebPortal.GraphQL.Tests\bin\Debug\netcoreapp2.2\DMux.WebPortal.GraphQL.Test.Base.deps.json. Make sure test project has a nuget reference of package "Microsoft.NET.Test.Sdk". ##[debug]Processed: ##vso[task.logissue type=error;]Unable to find d:\a\1\s\test\DMux.WebPortal.GraphQL.Tests\bin\Debug\netcoreapp2.2\DMux.WebPortal.GraphQL.Test.Base.deps.json. Make sure test project has a nuget reference of package "Microsoft.NET.Test.Sdk".

The project does have the Nuget package:

But I wonder if the AnyCPU is relevant? My Pipeline is configured for AnyCPU, and the unit test project is too.

Can someone suggest anything?

  • Kevin

1 Answer(s)
  • User Avatar
    0
    dmux created

    This one is resolved now.

    I updated Microsoft.NET.Test.Sdk to 16.3.0 (from 16.2.0). This changed the error messages, which led me to the solution. The wildcard selection of DLLs in the Azure test selection picks up xUint DLLs as well. Changing the selection is the solution, which I learned from this advice https://xunit.net/docs/getting-test-results-in-azure-devops

    I found that I could not figure out what all the exclusions would need to be (The ones listed in that website didn't seem sufficient), so instead I explicitly specified the MyProjectTests.dll file without a wildcard.

    Unit tests now run in Azure.