问题描述:

I am using EF Core in dotnet core app. In my project.json i have next configuration:

{

"version": "0.0.0.1",

"dependencies": {

"Autofac.Extensions.DependencyInjection": "4.0.0",

"AutotestConsolidationServer.Database": "1.0.0-*",

"Microsoft.ApplicationInsights.AspNetCore": "1.0.0",

"Microsoft.AspNetCore.Mvc": "1.1.0",

"Microsoft.AspNetCore.Routing": "1.1.0",

"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",

"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",

"Microsoft.AspNetCore.StaticFiles": "1.0.0",

"Microsoft.EntityFrameworkCore": "1.1.0",

"Microsoft.EntityFrameworkCore.Design": "1.1.0",

"Microsoft.EntityFrameworkCore.Tools": {

"version": "1.1.0-preview4-final",

"include": "all"

},

"Microsoft.EntityFrameworkCore.Tools.DotNet": {

"version": "1.1.0-preview4-final",

"include": "all"

},

"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.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.NETCore.App": {

"version": "1.1.0",

"type": "platform"

},

"Npgsql.EntityFrameworkCore.PostgreSQL": "1.1.0",

"Npgsql.EntityFrameworkCore.PostgreSQL.Design": "1.1.0"

},

"tools": {

"Microsoft.EntityFrameworkCore.Tools.DotNet": "1.1.0-preview4-final"

},

"frameworks": {

"netcoreapp1.6": {

"imports": [

"dnxcore50"

]

}

},

"buildOptions": {

"emitEntryPoint": true,

"preserveCompilationContext": true

},

"runtimes": {

"win10-x64": {},

"ubuntu.16.10-x64": {}

},

"runtimeOptions": {

"configProperties": {

"System.GC.Server": true

}

},

"publishOptions": {

"include": [

"wwwroot",

"**/*.cshtml",

"appsettings*.json",

"databaseconfig*.json",

"web.config",

"run.sh"

]

}

}

but after publish in output folder there is no any files named ef.dll and off course command dotnet ef returns No executable found matching command "dotnet-ef". where is my mistake?

update: after @kloarubeek's hint dotnet-ef.dll appears in publish out dir, but command dotnet ef still not works.

网友答案:

You refer to it in the tools section. If you want to publish it, move it to the dependencies:

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

Publishing this will result in a dotnet-ef.dll in the output folder.

相关阅读:
Top