Open eagle-k opened 1 year ago
Also trying to test this int a net7.0 project without success. As far as I understand this library was compiled with a reference to Microsoft.EntityFrameworkCore.Design 6.0 which seems to not be compatible with Entity Framework 7.
What I have found recently: The error described has nothing to do with dotnet-ef tool installed - it fails equally with version 7 and 6. It also has nothing to do (directly) with your project target version, fails both with .net7 and .net6 What really matters is the version of Microsoft.EntityFrameworkCore nuget package used in your project. I downgraded mine to 6.0.13 and the command 'dotnet ef migrations add' works like a charm. I have not changed the version of EFCore.FSharp though, as it's built with EntityFrameworkCore v6.0 As a workaround this downgrade works, in theory you can downgrade, add migrations and upgrade again but this way is a bit risky to me, there are some breaking changes in EF Core since 6.0 and one day they'll bite me.
Further investigation shows that one of the breaking changes in EF Core is in 'ICSharpHelper' , namely 'ICSharpHelper.Fragment'. ave not looked deeper, whether it's changed or removed or moved somewhere else, not sure.
Would be nice to see the fix in EFCore.FSharp soon. I could help within my humble knowledge, but, realistically, not much :)
I also had this problem, and manually editing the paket.lock
file to target 6.0.13 for Microsoft.EntityFrameworkCore and other dependencies that where targeting 7.0.9 on my machine. Just did a search an replace. My paket.lock
diff after changes:
diff --git a/paket.lock b/paket.lock
index 870c228..3b86826 100644
--- a/paket.lock
+++ b/paket.lock
@@ -5,30 +5,30 @@ NUGET
Microsoft.EntityFrameworkCore.Design (>= 6.0) - restriction: >= net6.0
FSharp.Core (6.0.7)
Humanizer.Core (2.14.1) - restriction: >= net6.0
- Microsoft.Data.Sqlite.Core (7.0.9) - restriction: >= net6.0
+ Microsoft.Data.Sqlite.Core (6.0.13) - restriction: >= net6.0
SQLitePCLRaw.core (>= 2.1.4) - restriction: >= netstandard2.0
- Microsoft.EntityFrameworkCore (7.0.9) - restriction: >= net6.0
- Microsoft.EntityFrameworkCore.Abstractions (>= 7.0.9) - restriction: >= net6.0
- Microsoft.EntityFrameworkCore.Analyzers (>= 7.0.9) - restriction: >= net6.0
+ Microsoft.EntityFrameworkCore (6.0.13) - restriction: >= net6.0
+ Microsoft.EntityFrameworkCore.Abstractions (>= 6.0.13) - restriction: >= net6.0
+ Microsoft.EntityFrameworkCore.Analyzers (>= 6.0.13) - restriction: >= net6.0
Microsoft.Extensions.Caching.Memory (>= 7.0) - restriction: >= net6.0
Microsoft.Extensions.DependencyInjection (>= 7.0) - restriction: >= net6.0
Microsoft.Extensions.Logging (>= 7.0) - restriction: >= net6.0
- Microsoft.EntityFrameworkCore.Abstractions (7.0.9) - restriction: >= net6.0
- Microsoft.EntityFrameworkCore.Analyzers (7.0.9) - restriction: >= net6.0
- Microsoft.EntityFrameworkCore.Design (7.0.9) - restriction: >= net6.0
+ Microsoft.EntityFrameworkCore.Abstractions (6.0.13) - restriction: >= net6.0
+ Microsoft.EntityFrameworkCore.Analyzers (6.0.13) - restriction: >= net6.0
+ Microsoft.EntityFrameworkCore.Design (6.0.13) - restriction: >= net6.0
Humanizer.Core (>= 2.14.1) - restriction: >= net6.0
- Microsoft.EntityFrameworkCore.Relational (>= 7.0.9) - restriction: >= net6.0
+ Microsoft.EntityFrameworkCore.Relational (>= 6.0.13) - restriction: >= net6.0
Microsoft.Extensions.DependencyModel (>= 7.0) - restriction: >= net6.0
Mono.TextTemplating (>= 2.2.1) - restriction: >= net6.0
- Microsoft.EntityFrameworkCore.Relational (7.0.9) - restriction: >= net6.0
- Microsoft.EntityFrameworkCore (>= 7.0.9) - restriction: >= net6.0
+ Microsoft.EntityFrameworkCore.Relational (6.0.13) - restriction: >= net6.0
+ Microsoft.EntityFrameworkCore (>= 6.0.13) - restriction: >= net6.0
Microsoft.Extensions.Configuration.Abstractions (>= 7.0) - restriction: >= net6.0
Microsoft.EntityFrameworkCore.Sqlite (6.0.20)
Microsoft.EntityFrameworkCore.Sqlite.Core (>= 6.0.20) - restriction: >= net6.0
SQLitePCLRaw.bundle_e_sqlite3 (>= 2.1.2) - restriction: >= net6.0
- Microsoft.EntityFrameworkCore.Sqlite.Core (7.0.9) - restriction: >= net6.0
- Microsoft.Data.Sqlite.Core (>= 7.0.9) - restriction: >= net6.0
- Microsoft.EntityFrameworkCore.Relational (>= 7.0.9) - restriction: >= net6.0
+ Microsoft.EntityFrameworkCore.Sqlite.Core (6.0.13) - restriction: >= net6.0
+ Microsoft.Data.Sqlite.Core (>= 6.0.13) - restriction: >= net6.0
+ Microsoft.EntityFrameworkCore.Relational (>= 6.0.13) - restriction: >= net6.0
Microsoft.Extensions.DependencyModel (>= 7.0) - restriction: >= net6.0
Microsoft.Extensions.Caching.Abstractions (7.0) - restriction: >= net6.0
Microsoft.Extensions.Primitives (>= 7.0) - restriction: || (>= net462) (>= netstandard2.0)
Describe the bug Follow https://github.com/efcore/EFCore.FSharp/blob/master/GETTING_STARTED.md, and
dotnet ef migrations add Initial
fails.To Reproduce I will share the actual repository where the error occurred. https://github.com/eagle-k/FsEfTest
Expected behavior
dotnet ef migrations add Initial
succeeds.Desktop (please complete the following information):
Additional context
dotnet ef dbcontext info
succeeds.