I have recently started ASP.net core project with multilayered architecture, where CatalogDbContext and StartUp class in different layers:
I want to add migrations to DroneStore.Data layer. I change in command prompt current directory to ../DroneStore.Data/ and add command:
dotnet ef migrations add Initial
And got an error:
Unable to create an object of type 'CatalogDbContext'. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728
When I change current directory to ../DroneStore.Web/ and add this command i got error:
Your target project 'DroneStore.Web' doesn't match your migrations assembly 'DroneStore.Data'. Either change your target project or change your migrations assembly
Any suggections?
1) Change your currend directory in command prompt to:
cd ../DroneStore.Data/
2) Add to command -s option with path to StartUp project folder:
dotnet ef migrations add Initial -s ../DroneStore.Web/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.