I am following the Microsoft tutorial for creating an MVC application with .Net Core 3.1 . I'm using .Net Core 2.1 with Visual Studio 2017. My Visual Studio instance is managed by my company, so I'm not able to upgrade to .Net Core 3.1 because it requires Visual Studio 2019.
On the step to install the NuGet package for SqlServer , I receive error NU1107 because the .NetCore version of the package does not match the version of my project.
Is there a way to resolve this error without installing .Net Core 3.1? A different package to use perhaps?
Install-Package : NU1107: Version conflict detected for Microsoft.EntityFrameworkCore. Install/reference Microsoft.EntityFrameworkCore 3.1.0 directly to project MvcMovie to resolve this issue.
MvcMovie -> Microsoft.EntityFrameworkCore.SqlServer 3.1.0 -> Microsoft.EntityFrameworkCore.Relational 3.1.0 -> Microsoft.EntityFrameworkCore (>= 3.1.0)
MvcMovie -> Microsoft.AspNetCore.App 2.1.1 -> Microsoft.EntityFrameworkCore (>= 2.1.1 && < 2.2.0).
At line:1 char:1
+ Install-Package Microsoft.EntityFrameworkCore.SqlServer
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
Install-Package : Package restore failed. Rolling back package changes for 'MvcMovie'.
At line:1 char:1
+ Install-Package Microsoft.EntityFrameworkCore.SqlServer
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
I ran into some more issues trying to follow a .Net Core 3 tutorial using a .Net Core 2.1 environment, and eventually figured out that I could use an older version of the tutorial! I blame banner-blindness.
Right click your project and open "Manage Nuget Packages...". (Highlighted below)
Search for the Nuget Package, Microsoft.EntityFrameworkCore.SqlServer
, and change the version to an older 2.2 version. Then install that version of the Nuget Package. (Also highlighted)
This should fix your conflict with Microsoft.AspNetCore.App
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.