c# - PowerShell Commands Adding EF Migration by Code -
wondering if can me solve this.
i able use package manager console enable-migrations, add-migrations etc etc. want able using c# code via powershell object
what have far is:
var ps = powershell.create(); ps.addcommand("set-executionpolicy"); ps.addargument("unrestricted"); ps.addcommand("import-module"); ps.addparameter("name"); ps.addargument(@"'.\packages\entityframework.6.1.3\tools\entityframework.psm1'"; ps.addcommand("add-migration"); ps.addparameter("name"); ps.addargument("migration21sept"); ps.addparameter("projectname"); ps.addargument("context1"); ps.invoke();
but when execute code error stating: "the term 'add-migration' not recognized name of cmdlet, function, script file, or operable program"
browse entity directory, shift + right click select "open powershell window here"
dotnet ef migrations add "migrationname"
Comments
Post a Comment