I'm on macOS using dotnet cli version 6.0.403, running dotnet restore
on a .csproj and getting the following nuget restore errors which I don't understand. From what I can see all the requests for Microsoft.Extensions.Caching.Abstractions
are all for the same version (>= 6.0.0). What is the conflict?
/Users/code/legacy/LEAF/IntegrationTests/IntegrationTests.csproj : error NU1106: Unable to satisfy conflicting requests for 'Microsoft.Extensions.Caching.Abstractions': Microsoft.Extensions.Caching.Abstractions (>= 6.0.0) (via project/LEAF.DistributedCache.NATS 1.2.0), Microsoft.Extensions.Caching.Abstractions (>= 6.0.0) (via project/LEAF.Components.Services.Registration.NATS 1.1.0), Microsoft.Extensions.Caching.Abstractions (>= 6.0.0) (via package/LEAF.Components.Services.Registration.Contract 1.0.0), Microsoft.Extensions.Caching.Abstractions (>= 6.0.0) (via package/LEAF.Components.Services.Registration.Contract 1.0.0), Microsoft.Extensions.Caching.Abstractions (>= 6.0.0) (via package/LEAF.Components.Services.Registration.Contract 1.0.0), Microsoft.Extensions.Caching.Abstractions (>= 6.0.0) (via package/LEAF.Components.Services.Registration.Contract 1.0.0), Microsoft.Extensions.Caching.Abstractions (>= 6.0.0) (via package/LEAF.Components.Services.Registration.Contract 1.0.0), Microsoft.Extensions.Caching.Abstractions (>= 6.0.0) (via package/LEAF.Components.Services.Registration.Contract 1.0.0), Microsoft.Extensions.Caching.Abstractions (>= 6.0.0) (via package/LEAF.Components.Services.Registration.Contract 1.0.0), Microsoft.Extensions.Caching.Abstractions (>= 6.0.0) (via package/LEAF.Components.Services.Registration.Contract 1.0.0), Microsoft.Extensions.Caching.Abstractions (>= 6.0.0) (via package/LEAF.Components.Services.Registration.Contract 1.0.0), Microsoft.Extensions.Caching.Abstractions (>= 6.0.0) (via package/LEAF.Components.Services.Registration.Contract 1.0.0), Microsoft.Extensions.Caching.Abstractions (>= 6.0.0) (via package/Microsoft.Extensions.Caching.Memory 6.0.1), Microsoft.Extensions.Caching.Abstractions (>= 6.0.0) (via package/Microsoft.Extensions.Caching.Memory 6.0.1), Microsoft.Extensions.Caching.Abstractions (>= 6.0.0) (via package/LEAF.Components.Services.Registration.Contract 1.0.0), Microsoft.Extensions.Caching.Abstractions (>= 6.0.0) (via package/LEAF.Components.Services.Registration.Contract 1.0.0), Microsoft.Extensions.Caching.Abstractions (>= 6.0.0) (via package/LEAF.Components.Services.Registration.Contract 1.0.0), Microsoft.Extensions.Caching.Abstractions (>= 6.0.0) (via package/LEAF.Components.Services.Registration.Contract 1.0.0), Microsoft.Extensions.Caching.Abstractions (>= 6.0.0) (via package/Microsoft.Extensions.Caching.Memory 6.0.1), Microsoft.Extensions.Caching.Abstractions (>= 6.0.0) (via package/Microsoft.Extensions.Caching.Memory 6.0.1) Framework: (.NETCoreApp,Version=v6.0)
For me this was happening after I tried to debug my Nuget package by just referencing it from the consuming solution, which had a problem with it... So, I've added a
<ProjectReference Include="ProjectB"/>
which had its own
<ProjectReference Include="ProjectC"/>
And the problem was that few more projects in the consuming solution were referencing ProjectC via Nuget-reference:
<PackageReference Include="ProjectC" Version=.../>
So, ProjectC was referenced via Nuget PackageReference
and via ProjectReference
from different projects I referenced.
I assume Visual Studio cannot be sure it's exactly the same library if its referenced different ways - even if it has same name and same version (could be their signatures were different).
SOLUTION:
Replacing all PackageReference
to ProjectC with ProjectReference
in solution resolved the issue.
Doing vise a versa is also an option. The key is consistency of references to same assembly.