尝试从命令行运行我的EF工具时,我一直收到上述错误。
我已按照No executable found matching command "dotnet-ef"的所有建议无效。
我正在从项目根目录运行,并且根据另一个建议,我已经配置了我的库以发出一个入口点(没有区别)。
这是我的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
}
}
我的EF代码元素位于我的MVC项目引用的单独库中。
更新:我已经尝试从我的MVC项目中运行它以排除库怪异,我在以下项目中遇到了同样的问题.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%" ]
}
}
将此添加到github
答案 0 :(得分:1)
我刚刚测试过将EF.Tools从preview3降级到preview2,它们都被认可了。然后我在跑步时遇到错误......
'dotnet ef迁移添加'
找不到方法:'System.String Microsoft.EntityFrameworkCore.Metadata.Internal.EntityTypeExtensions.DisplayName(Microsoft.EntityFrameworkCore.Metadata.IEntityType)'。
看来预览3是必需的,但工具部分需要采用不同的措辞,如下所示......
Set<Employee> h = new HashSet<>();