C
C#2y ago
Hercules

❔ 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
Build started...
Build succeeded.
Specify --help for a list of available options and commands.
Unrecognized command or argument 'add-migration'.
Build started...
Build succeeded.
Specify --help for a list of available options and commands.
Unrecognized command or argument 'add-migration'.
8 Replies
SG97
SG972y ago
isn't it dotnet ef migrations add (name of first migration)
Hercules
HerculesOP2y ago
yes it is. as you can see in the image that what i'm writing
SG97
SG972y ago
? in your image I see dotnet ef add-migration MyFirstMigration
Hercules
HerculesOP2y ago
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.
SG97
SG972y ago
but the syntax is wrong you can see both (PM and .net cli versions) on that article
FusedQyou
FusedQyou2y ago
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 one
Hercules
HerculesOP2y ago
you're right, this should resolve my issue- I shouldn't use the dashes on CLI just as @FusedQyou explained too.
Accord
Accord2y ago
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.
Want results from more Discord servers?
Add your server