C# – Version conflict in AspNetCore

asp.net-corec

I have an Asp.Net Core 2 Mvc project. I'm currently trying to separate the data access into a separate project; however, as soon as I add the reference to the data access library, I get a version conflict:

error NU1107: Version conflict detected for
Microsoft.AspNetCore.Cryptography.Internal. Reference the package
directly from the project to resolve this issue.

error NU1107: MySite.Web -> MySite.DataAccess ->
Microsoft.Extensions.Identity.Stores 2.1.1 ->
Microsoft.Extensions.Identity.Core 2.1.1 ->
Microsoft.AspNetCore.Cryptography.KeyDerivation 2.1.1 ->
Microsoft.AspNetCore.Cryptography.Internal (>= 2.1.1)

error NU1107: MySite.Web -> Microsoft.AspNetCore.App 2.1.0 ->
Microsoft.AspNetCore.Cryptography.Internal (= 2.1.0).

I've tried instead referencing entity framework identity, but it gives the same error, but with the authentication library instead.

I imagine that the following line is quite an important piece of advice:

Reference the package directly from the project to resolve this
issue.

However, I'm unsure what, exactly, this means. My initial thought was that I would reference that package in the MySite.Web project, but speficy the version to be 2.1.0; but when I do that I get continually redirected in a perfect circle back to this same library.

Best Answer

The reason this happens is that your locally installed Microsoft.AspNetCore.App is of version 2.1.0 and not 2.1.1.

To update that you need to install the latest sdk/runtime.

You can find that on https://dot.net
Just go to Downloads and download the 2.1 SDK (v2.1.301) which includes latest 2.1.1 runtime.

I hope that helps!