Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to resolve assembly when running dotnet test with coverage #33

Closed
PrzemekGawron opened this issue Apr 9, 2018 · 11 comments
Closed
Labels
duplicate This issue or pull request already exists

Comments

@PrzemekGawron
Copy link

PrzemekGawron commented Apr 9, 2018

When 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.

@tonerdo tonerdo added the duplicate This issue or pull request already exists label Apr 12, 2018
@tonerdo
Copy link
Collaborator

tonerdo commented Apr 12, 2018

I believe this is the same as #21 which has been fixed in #23. A new NuGet package will go out next Monday with this fix

@tonerdo
Copy link
Collaborator

tonerdo commented Apr 16, 2018

New NuGet released https://www.nuget.org/packages/coverlet.msbuild/1.1.0. Feel free to reopen if you still run into the issue

@tonerdo tonerdo closed this as completed Apr 16, 2018
@PrzemekGawron
Copy link
Author

Works like a charm. Thank you!

@jp7677
Copy link

jp7677 commented Apr 19, 2018

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.

@peterdeme
Copy link

Confirmed, I've got Failed to resolve assembly: 'Microsoft.Extensions.Logging.Abstractions error and <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> solved my issue, too.

@jp7677
Copy link

jp7677 commented Aug 13, 2018

PS: An even better way than modifying your *.csprof file is to run dotnet test like
dotnet test /p:CollectCoverage=true /p:CopyLocalLockFileAssemblies=true

@Thomas-Coville
Copy link

Thanks !

This also solved an issue for me when running tests on libraries relying on StackExchange.Redis.StrongName
with errors like coverlet.msbuild.targets(7,5): error : Failed to resolve assembly: 'StackExchange.Redis.StrongName, Version=1.2.6.0

@avivka
Copy link

avivka commented Oct 23, 2018

Confirmed, I've got Failed to resolve assembly: 'Microsoft.Extensions.Logging.Abstractions error and running dotnet test like
dotnet test /p:CollectCoverage=true /p:CopyLocalLockFileAssemblies=true solved my issue, too.

@Structed
Copy link

Structed commented Nov 8, 2018

Perhaps this can be added to the README.md, @tonerdo?

@davenewza
Copy link

Had this happening with 2.3.2. /p:CopyLocalLockFileAssemblies=true fixed it.

jp7677 added a commit to jp7677/hellocoreclr that referenced this issue Feb 10, 2019
@keithwillcode
Copy link

keithwillcode commented Jun 14, 2019

Is using /p:CopyLocalLockFileAssemblies=true or <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> the prescribed way to fix this error? Any plans/thoughts on a fix that wouldn't require using this parameter?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

9 participants