I used nuget to add these to my project: Microsoft.EntityFrameworkCore.Design v 7.0.1 Pomelo.EntityFrameworkCore.MySql v 6.0.2
and scaffolding with: dotnet ef dbcontext scaffold Name=NorthwindDB Pomelo.EntityFrameworkCore.MySql --output-dir Models --context-dir Data --namespace Northwind.Models --context-namespace Northwind.Data --context NorthwindContext -f --no-onconfiguring
I end up with the following errors
Scaffolding fails with the following output:
C:\Northwind.MySQL\Northwind.MySQL\Northwind.MySQL.csproj : error NU1107: Version conflict detected for Microsoft.EntityFrameworkCore.Relational. Install/reference Microsoft.EntityFrameworkCore.Relational 7.0.1 directly to project Northwind.MySQL to resolve this issue.
C:\Northwind.MySQL\Northwind.MySQL\Northwind.MySQL.csproj : error NU1107: Northwind.MySQL -> Microsoft.EntityFrameworkCore.Design 7.0.1 -> Microsoft.EntityFrameworkCore.Relational (>= 7.0.1)
C:\Northwind.MySQL\Northwind.MySQL\Northwind.MySQL.csproj : error NU1107: Northwind.MySQL -> Pomelo.EntityFrameworkCore.MySql 6.0.2 -> Microsoft.EntityFrameworkCore.Relational (>= 6.0.7 && < 7.0.0).
Build FAILED.
C:\Northwind.MySQL\Northwind.MySQL\Northwind.MySQL.csproj : error NU1107: Version conflict detected for Microsoft.EntityFrameworkCore.Relational. Install/reference Microsoft.EntityFrameworkCore.Relational 7.0.1 directly to project Northwind.MySQL to resolve this issue.
C:\Northwind.MySQL\Northwind.MySQL\Northwind.MySQL.csproj : error NU1107: Northwind.MySQL -> Microsoft.EntityFrameworkCore.Design 7.0.1 -> Microsoft.EntityFrameworkCore.Relational (>= 7.0.1)
C:\Northwind.MySQL\Northwind.MySQL\Northwind.MySQL.csproj : error NU1107: Northwind.MySQL -> Pomelo.EntityFrameworkCore.MySql 6.0.2 -> Microsoft.EntityFrameworkCore.Relational (>= 6.0.7 && < 7.0.0).
0 Warning(s)
1 Error(s)
I tried adding a reference to the Microsoft.EntityFrameworkCore.Relational dll in my dependencies, but I got the same error.
I tried different versions of of the dependencies, I'm at my wits end. Has anyone successfully done this kind of scaffolding using the pomelo lib?
CodePudding user response:
The project Northwind.MySQL has the dependencies and sub dependencies :
- Pomelo.EntityFrameworkCore.MySql 6.0.2
- Microsoft.EntityFrameworkCore.Relational (>= 6.0.7 && < 7.0.0)
- Microsoft.EntityFrameworkCore.Design 7.0.1
- Microsoft.EntityFrameworkCore.Relational > 7.0.1
The project Northwind.MySQL has the dependency Pomelo.EntityFrameworkCore.MySql at version 6 that need the dependency Microsoft.EntityFrameworkCore.Relational at version 6.
Also the project Northwind.MySQL has the dependency Microsoft.EntityFrameworkCore.Design at version 7 that need the dependency Microsoft.EntityFrameworkCore.Relational at version 7.
The project Northwind.MySQL need indirectly the dependency Microsoft.EntityFrameworkCore.Relational at version 6 and 7... that isn't possible.
The solution is to manage the root dependencies that the sub dependencies match.
You can downgrade EF Core to version 6 like :
dotnet add package Microsoft.EntityFrameworkCore.Design --version 6.0.12
Or update Pomelo to version 7 (actually in beta) :
dotnet add package Pomelo.EntityFrameworkCore.MySql --version 7.0.0-silver.1