-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dotnet ef migrations fails with "...doesn't reference Microsoft.EntityFrameworkCore.Design ..." but design package is added #35544
Comments
You need to build the project once after adding the package, otherwise you get that error. |
Sorry, doesn't help.
Successful
Failed - "Your startup project 'Prj.EntityFramework.SqlServer' doesn't reference Microsoft.EntityFrameworkCore.Design. This package is required for the Entity Framework Core Tools to work. Ensure your startup project is correct, install the package, and try again."
Entity Framework Core .NET Command-line Tools 9.0.1 |
Can I also pipe in here and say this happened to me today. I'm not sure exactly when it started to happen, but it was working fine a week or two ago, and I don't think I've changed anything apart from keeping VS 2022 preview up to date. Removing the I am also using the scaffold command, not migrations. |
Strange, it's working in my console program.
I'm using VS Enterprise 2022 version 17.12.4 though, not a preview version.
|
This is something that generally works - I can't repro this, and almost all EF users use |
I don't know... I have 2 different projects on two computers, both running windows 11 with Microsoft Visual Studio Community 2022 (64-bit) - Preview Version 17.13.0 Preview 3.0. EF core tools upgraded to latest version, migration fails. I understand that most users don't have problems. We are using ef core for years, but this problem occured this week on both computers and I have no idea what changed, because source code did not... Sample project that does not work on my current setup: cmd: dotnet ef migrations add Initial --context TestDbContext -o Migrations/PostgreSQL/Test outputs: Build started... |
I experienced the same issue since Preview 3 of Visual Studio (.NET SDK 9.0.200-preview.0.25057.12) dotnet new globaljson --sdk-version 9.0.102 |
Using your repro, I'm not able to reproduce it. No error and migration is created. Using:
Unless we get repro, there's not much we can do. |
The error does not occur with the 9.0.102 but the current preview, as several comments stated above. I'm using:
|
@AndriySvyryd are we interested, given it is happening on preview version? |
Well, IMHO preview versions are released so everyone can check that the next official release won't break your stuff. So this issue can be seen as a hint that EF migrations might break with the next minor release of .NET SDK. |
This is a duplicate of #35265, it will be fixed in EF 10. As a workaround add <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<Publish>true</Publish>
</PackageReference> |
Added this to breaking changes. |
Question
We are having problems with ef tools.
Your startup project 'ENS3.Migrations' doesn't reference Microsoft.EntityFrameworkCore.Design. This package is required for the Entity Framework Core Tools to work. Ensure your startup project is correct, install the package, and try again.
But Microsoft.EntityFrameworkCore.Design is referenced and package manager restores the package. What could be wrong, how to diagnose the problem?
Your code
Stack traces
Verbose output
EF Core version
9.0.0
Database provider
No response
Target framework
.NET 9.0
Operating system
Windows 11
IDE
Microsoft Visual Studio Community 2022 (64-bit) - Preview Version 17.13.0 Preview 3.0
The text was updated successfully, but these errors were encountered: