❔ Can't run Add-migration to create my local database.
I have an web api and some .net standard class library that holds my entities but whenever i run "Add-migration" on the .net standard library i get a runtime issue I'm missing a startup file with corresponding framework.
So I checked the references between the different class libraries and saw that i have a project reference to the .net standard class library but when i run "Add-migration" i get the following message
8 Replies
isn't it
dotnet ef migrations add (name of first migration)
yes it is. as you can see in the image that what i'm writing
?
in your image I see
dotnet ef add-migration MyFirstMigration
the name of my firstmigration would be "MyFirstMigration" I believe you create the migrations after running update-database
https://www.entityframeworktutorial.net/efcore/entity-framework-core-migration.aspx
Under Adding a Migration
Migration in Entity Framework Core
Learn about migrations in EF Core. Learn how to add migration, update database and generate script.
but the syntax is wrong
you can see both (PM and .net cli versions) on that article
Yes, syntax is wrong. You use
dotnet ef add migration <args>
for regular terminal and Add-Migration <args>
for the Package Manager Console
So no dash in the first oneyou're right, this should resolve my issue- I shouldn't use the dashes on CLI just as @FusedQyou explained too.
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.