` Failed to resolve assembly` when running dotnet test with coverage
See original GitHub issueWhen I run command
dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
all test are passing and code coverage is correctly generated which is good. However returned exit code from command is 1 due to this error:
coverlet.msbuild\1.0.2\build\netstandard2.0\coverlet.msbuild.targets(13,5): error : Failed to resolve assembly: 'Common, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null' [C:\Source\Repos\MyApp\src\Test\Test.csproj]
Where Common
is one of the referenced projects.
When I just run dotnet test
everything is working and exit code is 0.
Issue Analytics
- State:
- Created 5 years ago
- Comments:11
Top Results From Across the Web
Why dotnet test tool is not creating code coverage report?
Basically I forgot to add the coverlet msbuild NuGet package into my test project. After that, all worked fine with the following command:...
Read more >Troubleshoot code coverage - Visual Studio
In Test Explorer, select Run All to verify that the tests run successfully. Fix any failures before using Analyze Code Coverage.
Read more >Azure Piplines throw error when running tests in .net core ...
Data collector 'Code Coverage' message: Failed to initialize code coverage datacollector with error: System.TypeLoadException: Could not load ...
Read more >Azure DevOps: tests failing when addressing multiple .Net ...
Data collector 'Code Coverage' message: Failed to initialize code coverage datacollector with error: System.TypeLoadException: Could not load ...
Read more >Customizing Code Coverage Analysis - Visual Studio
Learn how to install and use the dotnet-coverage CLI tool to collect code coverage data of a running process.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just for reference, I had the same issue with some 3rd party packages, even with version 1.1.1. Including
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
in the project file of my test project fixed it for me.PS: An even better way than modifying your *.csprof file is to run dotnet test like
dotnet test /p:CollectCoverage=true /p:CopyLocalLockFileAssemblies=true