.Net Core 3.1 Function App Unit Test Fails trying to find System.Runtime 4.2.2.0

307 views Asked by At

I have an Azure Function app that works fine locally and works in the cloud. It works when I wrapped XUnit tests around it. However, when I tried to leverage OpenCover to run the unit tests to generate a code coverage report, I get an error.

Batch file to generate report:

"%USERPROFILE%\.nuget\packages\OpenCover\4.7.1221\tools\OpenCover.Console.exe" -register:user -target:"%USERPROFILE%\.nuget\packages\xunit.runner.console\2.4.1\tools\net472\xunit.console.exe" -targetdir:"..\S3.ReplicationSolution.UnitTests\bin\Debug\netcoreapp3.1" -targetargs:"S3.ReplicationSolution.UnitTests.dll" -filter:"+[S3.ReplicationSolution*]* -[*S3.Replication.UnitTests*]*" -mergebyhash -output:.\CodeCoverageResults\ProjectCoverageReport.xml 

Command Line results from batch file:

Executing: C:\Users\DonSartain\.nuget\packages\xunit.runner.console\2.4.1\tools\net472\xunit.console.exe
xUnit.net Console Runner v2.4.1 (64-bit Desktop .NET 4.7.2, runtime: 4.0.30319.42000)
System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

The only place I can see this dependency referenced is in the Solution -> Dependencies -> Frameworks -> Microsoft.NETCore.App location. I'm not even using it in the project files. I've tried including it manually and that didn't work. I've also tried using a later version in a NuGet package and that didn't resolve it either.

What else can I try here?

1

There are 1 answers

0
ATD On

This seems to be related: https://github.com/xunit/xunit/issues/1950

Try dotnet test