我想在一个单独的类库项目(使用 name AbsenceRequests.Data.EF)中进行 EntityFramework 工作,以便可以单独维护它。
我遇到了 project.json 系统的一些问题,目前它看起来像这样:
{
"version": "1.0.0-*",
"description": "AbsenceRequests.Data.EF Class Library",
"authors": [ "authorName" ],
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",
"frameworks": {
"netcore50": {
"dependencies": {
"Microsoft.CSharp": "4.0.1-beta-23516",
"System.Collections": "4.0.11-beta-23516",
"System.Linq": "4.0.1-beta-23516",
"System.Runtime": "4.0.21-beta-23516",
"System.Threading": "4.0.11-beta-23516"
}
}
},
"dependencies": {
"EntityFramework.Commands": "7.0.0-rc1-final",
"EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final"
}
}
当我dnx ef在命令行上运行时,我收到以下错误:
C:\...\AbsenceRequests\AbsenceRequests.Data.EF>dnx ef
System.InvalidOperationException: The current runtime target framework is not compatible with 'AbsenceRequests.Data.EF'.
Current runtime target framework: 'DNX,Version=v4.5.1 (dnx451)'
Version: 1.0.0-rc1-16202
Type: Clr
Architecture: x86
OS Name: Windows
OS Version: 6.1
Runtime Id: win7-x86
Please make sure the runtime matches a framework specified in project.json
bij Microsoft.Dnx.ApplicationHost.DefaultHost.GetEntryPoint(String applicatio
nName)
bij Microsoft.Dnx.ApplicationHost.Program.ExecuteMain(DefaultHost host, Strin
g applicationName, String[] args)
bij Microsoft.Dnx.ApplicationHost.Program.Main(String[] args)
--- Einde van stacktracering vanaf vorige locatie waar uitzondering is opgetrede
n ---
bij System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
bij Microsoft.Dnx.Runtime.Common.EntryPointExecutor.Execute(Assembly assembly
, String[] args, IServiceProvider serviceProvider)
bij Microsoft.Dnx.Host.Bootstrapper.RunAsync(List`1 args, IRuntimeEnvironment
env, String appBase, FrameworkName targetFramework)
bij Microsoft.Dnx.Host.RuntimeBootstrapper.ExecuteAsync(String[] args, Bootst
rapperContext bootstrapperContext)
bij Microsoft.Dnx.Host.RuntimeBootstrapper.Execute(String[] args, Bootstrappe
rContext bootstrapperContext)
当我使用常规的 Web 项目(甚至是从头开始)时,效果很好。但是对于类库项目,这会失败。有什么想法吗?我究竟做错了什么?
谢谢伊夫