Your startup project doesn't reference Microsoft.EntityFrameworkCore.Design
Hello Guys, I created a project using Asp.net core 3.1 and Entity framework core 3.1 database first.
I have two projects :
Test.GoogleNotification (sln)
--- Test.GoogleNotification.Dal (Data access layer)
--- Test.GoogleNotification.App (web app)
To use entity framework core, I installed 3 packages below inside Test.GoogleNotification.Dal
project:
Microsoft.EntityFrameworkCore.Design (v 3.1.22)
Microsoft.EntityFrameworkCore.SqlServer (v 3.1.22)
Microsoft.EntityFrameworkCore.Tools (v 3.1.22)
After then I open Package Manager Console to run the command below to help generate FE core:
PM> Scaffold-DbContext "Server=DESKTOP-9HHLK4D;Database=GoogleNotification;user id=sa;password=sa@12345;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
But I got an error Your startup project doesn't reference Microsoft.EntityFrameworkCore.Design.
PM> Scaffold-DbContext "Server=DESKTOP-9HHLK4D;Database=GoogleNotification;user id=sa;password=sa@12345;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
Build started...
Build succeeded.
Your startup project 'Test.GoogleNotification.App' 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.
PM>
I chose the default project combobox is Test.GoogleNotification.Dal but I don't know why it throws an error in the project Test.GoogleNotification.App.
How can I fix it?
-
L1
Lester Laban Laban Feb 24 2022
You can re-check what is the current startup project? it is
Test.GoogleNotification.App
, right? You have to set it toTest.GoogleNotification.Dal
and it will be solved for you. -
ר0
ראובן בן סימון Feb 24 2022
You can install Microsoft.EntityFrameworkCore.Design package for that project (
Test.GoogleNotification.App
) by using the command below:Install-Package Microsoft.EntityFrameworkCore.Design -Version <version>
<version>
: You can see all versions here https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.Design/If you installed it but it still throws the same error, maybe you need to build the project and try again.
* Type maximum 2000 characters.
* All comments have to wait approved before display.
* Please polite comment and respect questions and answers of others.