1
votes

I have a project I have written in ASP.NET core since the beta days. Always upgraded to later version and was able to run migrations with migrations command package manager consoler.

However latest Visual Studio 2017 Update 2 migrations commands in package console are no longer recognized.

If I run the command in Package Manager Console

add-migration

I get

The term 'add-migration' is not recognized as the name of a cmdlet, function, script file, or operable program

I upgraded from Visual Studio 2017 Update 1 and one of my packages in my class library csproj Microsoft.EntityFrameworkCore.Tools seem to have been upgraded from 1.1.0 to 1.1.1 which seems to have caused migration commands to not be recognized. To try resolve this I changed Tools back to 1.1.0 back but still the migrations powershell commmands don't work. I am using the powershell commands and not the dotnet ef commands which aren't supported in a class library.

I tried - adding/removing packages Microsoft.EntityFrameworkCore.Tools.DotNet and to my csproj and Microsoft.EntityFrameworkCore.Tools reopening closing Visual Studio in between. - running dotnet restore - running the correspondingcsproj version nuget ef toold init.ps1 in package manager console I have tried all the stackoverflow answers. Nothing works

1

1 Answers

0
votes

I resolved it by

  • Close all instances of Visual Studio 2017
  • deleting all folders called microsoft.entityFrameworkcore in C:\Users\myuser.nuget\packages\
  • Open my visual studio project.
  • Run dotnet restore on all my projects
  • Run add-migration command in package manager console with my class library the Default project and it gets recognized