Microsoft.EntityFrameworkCore.Design is not installed

asp.net-core asp.net-web-api c# entity-framework-core

Question

I am trying to run the command Add-Migration (code first approach) using EntityFramework Core using PM Console. I cannot get past this error: Cannot execute this command because Microsoft.EntityFrameworkCore.Design is not installed. Install the version of that package that matches the installed version of Microsoft.EntityFrameworkCore and try again. This is my project.json file:

    {
  "dependencies": {
    "Microsoft.NETCore.App": "1.1.0",
    "Microsoft.AspNetCore.Mvc": "1.0.1",
    "Microsoft.AspNetCore.Routing": "1.1.0",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
    "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
    "Microsoft.Extensions.Configuration.Json": "1.0.0",
    "Microsoft.Extensions.Logging": "1.1.0",
    "Microsoft.Extensions.Logging.Console": "1.0.0",
    "Microsoft.Extensions.Logging.Debug": "1.0.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
    "Microsoft.EntityFrameworkCore": "1.1.0",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
    "Microsoft.EntityFrameworkCore.Design": "1.1.0"
  },
  "tools": {
    "Microsoft.EntityFrameworkCore.Tools.DotNet": "1.1.0-preview4-final",
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
  },

  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
  },
  "runtimes": {
    "win10-x64": {}
  },

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

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

  "publishOptions": {
    "include": [
      "wwwroot",
      "**/*.cshtml",
      "appsettings.json",
      "web.config"
    ]
  },

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

As you can see my dependencies and tools are version 1.1.0. These are my references: References

Things I have tried:

  • Close/reopen Visual Studio
  • dotnet restore
  • My startup file has my connection string registered in ConfigServices

I have everything installed that I supposed to (that I am aware of). I have also looked at other posts for this problem on StackOverflow to no avail.

Anyone able to get past this? I appreciate any help.

1
7
1/11/2017 3:00:10 PM

Accepted Answer

First, fix inconsistency between netcoreapp1.0 and "Microsoft.NETCore.App": "1.1.0"

Second, you need Microsoft.EntityFrameworkCore.Tools for running PM-Console commands.

Existing Microsoft.EntityFrameworkCore.Tools.DotNet is for dotnet CLI commands. You may create migrations running dotnet ef migrations add <name> from command line.

Details about using PM and/or CLI is here

13
1/11/2017 9:03:43 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow