✅ Adding EF Core Migration Error
Hi friends,
I have a solution contains the structure mentioned in the attached screen-shot,
All the projects are
Class Library
, except the WEB
project is an ASP.Net Core 7 Angular
APP.
The issue:
In the EF Core
project I have setup the EF Core
DBContext
, and the WEB
project contains the Conenction String
in the AppSettings.Json
.
When I try dotnet ef migration add Initial
command I get the following error :
Unable to create an object of type 'AppDbContext'. For the different patterns supported at design time, see ...Note: I'm using the
VS Code
IDE,
Question:
Please how do I can solve this issue ?
Massive thanks in advance.5 Replies
Ensure you have the correct "Default project" selected in the Package Manager Console:
I'm using
Visual Studio Code
not Visual Studio
Especially this is the first time for me to take this advanture and developing this kind of apps using VS Code
You may need to play around with the project and startup ptoject command line switches
Alright I fixed it by using the following
CLI
command:
Yep