2

I keep getting the above error when trying to run my EF tools from the command line.

I have followed all of the suggestions at No executable found matching command "dotnet-ef" to no avail.

I am running from the project root and, as per another suggestion, I have configured my library to emit an entry point (which made no difference).

Here is my project.json

{
    "version": "1.0.0-*",

    "dependencies": {
        "NETStandard.Library": "1.6.1-preview1-24530-04",
        "Microsoft.AspNetCore.Session": "1.1.0-preview1-final",
        "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.1.0-preview1-final",
        "Microsoft.EntityFrameworkCore.SqlServer": "1.1.0-preview1-final",
        "Microsoft.EntityFrameworkCore.SqlServer.Design": "1.1.0-preview1-final",
        "Microsoft.EntityFrameworkCore.Tools": {
            "version": "1.0.0-preview3-final",
            "type": "build"
        },
        "Microsoft.NETCore.App": "1.1.0-preview1-001100-00",
        "Newtonsoft.Json": "9.0.1"
    },

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

    "tools": {
        "Microsoft.Extensions.Caching.SqlConfig.Tools": "1.0.0-preview3-final",
        "Microsoft.EntityFrameworkCore.Tools": {
            "version": "1.0.0-preview3-final",
            "imports": "portable-net451+win8"
        }
    },

    "buildOptions": {
        "emitEntryPoint": true
    }
}

My EF code elements are in a separate library referenced by my MVC project.

UPDATE: I have tried running this from my MVC project to rule out library weirdness and I get the same problem with the following project.json

{
    "userSecretsId": "aspnet-blahblahblah",

    "dependencies": {
        "MyLibrary": {
            "target": "project"
        },
        "Microsoft.AspNetCore.Authentication.Cookies": "1.1.0-preview1-final",
        "Microsoft.AspNetCore.Diagnostics": "1.1.0-preview1-final",
        "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.1.0-preview1-final",
        "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.1.0-preview1-final",
        "Microsoft.AspNetCore.Mvc": "1.1.0-preview1-final",
        "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview3-final",
        "Microsoft.AspNetCore.Routing": "1.1.0-preview1-final",
        "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0-preview1-final",
        "Microsoft.AspNetCore.Server.Kestrel": "1.1.0-preview1-final",
        "Microsoft.AspNetCore.StaticFiles": "1.1.0-preview1-final",
        "Microsoft.EntityFrameworkCore.SqlServer": "1.1.0-preview1-final",
        "Microsoft.EntityFrameworkCore.SqlServer.Design": "1.1.0-preview1-final",
        "Microsoft.EntityFrameworkCore.Tools": {
            "version": "1.0.0-preview3-final",
            "type": "build"
        },
        "Microsoft.Extensions.Caching.SqlServer": "1.0.0",
        "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0-preview1-final",
        "Microsoft.Extensions.Configuration.Json": "1.1.0-preview1-final",
        "Microsoft.Extensions.Configuration.UserSecrets": "1.1.0-preview1-final",
        "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.1.0-preview1-final",
        "Microsoft.NETCore.App": "1.1.0-preview1-001100-00",
        "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.1.0-preview1-final",
        "Microsoft.VisualStudio.Web.CodeGeneration.Tools": "1.0.0-preview3-final",
        "Microsoft.VisualStudio.Web.CodeGenerators.Mvc": "1.0.0-preview3-final"
    },

    "tools": {
        "Microsoft.Extensions.SecretManager.Tools": "1.0.0-preview3-final",
        "Microsoft.EntityFrameworkCore.Tools": {
            "version": "1.0.0-preview3-final",
            "imports": "portable-net451+win8"
        }
    },

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

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

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

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

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

    "scripts": {
        "prepublish": [ "npm install", "gulp build-prod" ],
        "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
    }
}

I've also added this to github at https://github.com/aspnet/EntityFramework/issues/6892

Community
  • 1
  • 1
Keith Jackson
  • 2,475
  • 3
  • 19
  • 51

1 Answers1

1

I have just tested downgrading EF.Tools from preview3 to preview2 and it was all recognised fine. Then I got an error when running...

'dotnet ef migrations add'

Method not found: 'System.String Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.DisplayName(Microsoft.EntityFrameworkCore.Metadata.IEntityType)'.

It appears that preview3 IS Required but the tools section needs to be worded differently, as follows...

"tools": {
  "Microsoft.EntityFrameworkCore.Tools.DotNet": "1.0.0-preview3-final"
},
Keith Jackson
  • 2,475
  • 3
  • 19
  • 51