ASPNET5 Class 库抛出当前运行时目标框架与“<ProjectName>”不兼容
ASPNET5 Class Library throws Current Runtime Target Framework is not compatible with '<ProjectName>'
我想 EntityFramework 在一个单独的 class 库项目(名称为 AbsenceRequests.Data.EF
)中工作,以便它可以单独维护。
我 运行 遇到了 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 项目(即使是从头开始)时,它运行良好。但是对于 class 库项目,这会失败。有什么想法吗?我做错了什么?
谢谢
伊夫
我自己遇到了这个问题,我通过将以下内容添加到 project.json.
来解决
"frameworks": {
"dnx451": { },
"dnxcore50": { }
},
当我最初创建 class 库项目并将其更改为 dnx451 时,它被设置为 net451。因此确保它知道该项目使用的框架的版本。
我想 EntityFramework 在一个单独的 class 库项目(名称为 AbsenceRequests.Data.EF
)中工作,以便它可以单独维护。
我 运行 遇到了 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 项目(即使是从头开始)时,它运行良好。但是对于 class 库项目,这会失败。有什么想法吗?我做错了什么?
谢谢 伊夫
我自己遇到了这个问题,我通过将以下内容添加到 project.json.
来解决"frameworks": {
"dnx451": { },
"dnxcore50": { }
},
当我最初创建 class 库项目并将其更改为 dnx451 时,它被设置为 net451。因此确保它知道该项目使用的框架的版本。