This version of the Entity Framework Core Package Manager Tools Console does not support these project types

After updating an existing project in ASP.NET Core 1.1 and Entity Framework Core 1.1 with this tutorial,
I tried to perform "Migrate Migration Add-MigrationName" in Package Management Console but got the error:

The Startup project 'src \ ProjectName' is an ASP.NET Core or .NET Core project for Visual Studio 2015. This version of the Entity Framework Package Management Console Tool does not support these project types.

I am using VS 2015 Update 3.
Project.json

{
  "dependencies": {
    "CoursesManagement.DAL": "1.0.0-*",
    "Microsoft.AspNetCore.Diagnostics": "1.1.1",
    "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.1.1",
    "Microsoft.AspNetCore.Mvc": "1.1.2",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.1.1",
    "Microsoft.AspNetCore.Server.Kestrel": "1.1.1",
    "Microsoft.AspNetCore.StaticFiles": "1.1.1",
    "Microsoft.Extensions.Configuration.FileExtensions": "1.1.1",
    "Microsoft.Extensions.Configuration.Json": "1.1.1",
    "Microsoft.Extensions.Logging.Console": "1.1.1",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.1.1",
    "Microsoft.NETCore.App": "1.1.1",
    "Microsoft.EntityFrameworkCore": "1.1.1",
    "Microsoft.EntityFrameworkCore.Tools": {
      "version": "1.1.0",
      "type": "build"
    },
    "Microsoft.EntityFrameworkCore.Design": "1.1.1"
  },

  "tools": {
    "Microsoft.EntityFrameworkCore.Tools": "1.1.0",
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
    "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final"
  },

  "frameworks": {
    "netcoreapp1.1": {
      "dependencies": {
      },
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
  },

  "runtimes": {
    "win10-x64": {}
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "web.config"
    ]
  },

  "scripts": {
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}

      

global.json

{
  "projects": [ "src" ],
  "sdk": {
    "version": "1.0.0-preview2-003131"
  }
}

      

+3


source to share


3 answers


As mentioned in this blog,

We now encourage everyone to switch to MSBuild and csproj from project.json. As I said above, we will not be supporting any new .NET Core tools in Visual Studio 2015. We will also not be updating the Visual Studio 2015 based tools project.json.

You are using a EFCore.Tools

version of the package 1.1.0

that does not support project.json. The tool for project.json never made it to RTM. The corresponding preview version for use in EF Core 1.1 packages is EFCore.Tools

1.1.0-preview4-final

.



Also, as mentioned in other answers, if you want to use powershell commands, you need to install the package EFCore.Tools

, but if you want dotnet ef

, then you need to install EFCore.Tools.DotNet

(the version 1.1.0-preview3-final

with preview4-final was a minor issue).

As noted above, there will be no updates to the project.json tools. You can use the preview package, although your best bet would be to upgrade to VS2017 csproj when you can.

+5


source


As per the official announcement of the ASP.NET team (see GitHub ), the package has Microsoft.EntityFrameworkCore.Tools

been split into Microsoft.EntityFrameworkCore.Tools

and Microsoft.EntityFrameworkCore.Tools.DotNet

.

You need to link to the later one if you want to keep using the commands dotnet ef

. If you only want to use old powershell style commands ( Database-Update

, Add-Migration

etc.), then the old package should suffice.

When linking Microsoft.EntityFrameworkCore.Tools.DotNet``there is no need to also reference ``Microsoft.EntityFrameworkCore.Tools

.

Rowan Miller quote



If you are using ASP.NET Core, you need to update the tools in the project.json section to use the new Microsoft.EntityFrameworkCore.Tools.DotNet Package (not Microsoft.EntityFrameworkCore.Tools Package).

"tools": {
  "Microsoft.EntityFrameworkCore.Tools.DotNet": "1.0.0-preview3-final" 
},

      

Since the design of the .NET CLI Tools has become necessary for us to separate the dotnet ef tools into this separate package. Microsoft.EntityFrameworkCore.Tools is still used for Package Manager Console commands.

Now that EF Core is released it should of course be

 "tools": {
   "Microsoft.EntityFrameworkCore.Tools.DotNet": "1.0.0" 
 },

      

Also note that the tools do not use the EF version itself. The latest version of tools is still 1.0.0 for Tools.DotNet (see Nuget ) and 1.1.0 for tools (see Nuget again ).

+5


source


I believe that in .NET Core and EF Core, different combats are different.

Try

dotnet ef migrations add MigrationName

      

and

dotnet ef database update

      

Here are the dotnet cli commands

+1


source







All Articles