1

Hi everyone I've the problem with EFCore migration in project on ASP.NET Core. Some technical info: OS: macOS

dotnet --version 1.0.0-preview2-003148

Here is my project.json:

{
  "dependencies": {
    "Microsoft.NETCore.App": {
      "version": "1.0.1",
      "type": "platform"
    },
    "Microsoft.AspNetCore.Mvc": "1.0.1",
    "Microsoft.AspNetCore.Routing": "1.0.1",
    "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.Configuration.CommandLine": "1.0.0",
    "Microsoft.Extensions.Logging": "1.1.0-preview1-final",
    "Microsoft.Extensions.Logging.Console": "1.1.0-preview1-final",
    "Microsoft.Extensions.Logging.Debug": "1.1.0-preview1-final",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
    "Microsoft.EntityFrameworkCore": "1.1.0-preview1-final",
    "Microsoft.Extensions.Logging.Abstractions": "1.1.0-preview1-final",
    "Npgsql.EntityFrameworkCore.PostgreSQL": "1.0.2",
    "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview3-final",
    "Microsoft.EntityFrameworkCore.Design": {
      "type": "build",
      "version": "1.1.0-preview1-final"
    },
    "Npgsql.EntityFrameworkCore.PostgreSQL.Design": "1.0.2"
  },
  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
    "Microsoft.EntityFrameworkCore.Tools": {
      "version": "1.0.0-preview3-final",
      "imports": [
        "portable-net45+win8+dnxcore50",
        "portable-net45+win8"
      ]
    }
  },
  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ],
      "buildOptions": {
        "emitEntryPoint": true
      }
    }
  },
  "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%"
    ]
  },
  "tooling": {
    "defaultNamespace": "TTT"
  }
}

I launch "dotnet ef" command from project.json folder.

My actions:

1) dotnet restore

2) dotnet ef

After that I get this error: "No executable found matching command "dotnet-ef".

I have static "Main" method in Program class (Program.cs).

Does anyone have an idea what I am doing wrong?

Thanks.

4
  • What error is encountered after doing the actions listed?
    – JohnH
    Oct 27, 2016 at 16:25
  • This error: "No executable found matching command "dotnet-ef""
    – CMaker
    Oct 27, 2016 at 16:28
  • How are you typing the command? dotnet ef or dotnet-ef or dotnet -ef?
    – mason
    Oct 27, 2016 at 16:36
  • I tried commands: "dotnet ef", "dotnet-ef" and get erorr.
    – CMaker
    Oct 27, 2016 at 16:42

2 Answers 2

9

You need to add "Microsoft.EntityFrameworkCore.Tools.DotNet": "1.0.0-preview3-final" to the tools section.

See https://blogs.msdn.microsoft.com/dotnet/2016/10/25/announcing-entity-framework-core-1-1-preview-1/ for more info

2
  • All others' answers didn't solve the problem. Only yours do.
    – t123yh
    Nov 8, 2016 at 7:25
  • This is the only version that works for me at this time. 1.1.0-preview4-final does not exist/cannot be resolved at compile-time.
    – AJ.
    Dec 15, 2016 at 15:22
0

Version 1.1.0 was released today, so the correct version to add in project.json now is 1.1.0-preview4-final:

"tools": {
    "Microsoft.EntityFrameworkCore.Tools.DotNet": "1.1.0-preview4-final"
}
3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.