I am trying to run Add-Migration InitialCreate command from package manager console from a .NET Core 2.0 MVC application. After looking at all possible sources still not abl
Had the same issue. It happened after i updated Microsoft.AspNetCore.All from 2.0.0-preview2-final to 2.0.0. Guess the reason why it fails is that i have .NET Core Preview 2 runtime installed.
EFCore got updated too. So please, make sure you have same nuget and runtime versions
UPDATE: Now .NET Core runtime and SDK 2.0 released https://www.microsoft.com/net/download/core. After install you can safely update your packages to 2.0.0
You need change your class Program
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.Build();
}
This class changed with dotnet core 2.0.0
I had the same issue
My solution contained a console application and an api application which contained the dbcontext code.
I had set the start up project to the console application. When I changed the start up project to the api application the error dissapeared.