PowerShell Commands Adding EF Migration by Code

Question:

Wondering if anyone can help me solve this.

I am able to use the Package Manager Console to Enable-Migrations, Add-Migrations etc etc. But I want to be able to do this using c# code via the PowerShell object

What I have so far is:

But when I execute this code I get an error stating: “The term ‘Add-Migration’ is not recognized as the name of a cmdlet, function, script file, or operable program”

Answer:

Browse to your entity directory, shift + right click then select “Open powershell window here”

dotnet ef migrations add “MigrationName”

Source:

PowerShell Commands Adding EF Migration by Code by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply