Kestrel 跑哪个框架? [英] Kestrel Running which framework?
问题描述
我有一个新的 ASP.NET 5 项目并如下设置 project.json;
I have a new ASP.NET 5 project and setup the project.json as below;
"frameworks": {
"dnx451": {
"dependencies": {
"ExternalLibrary": "1.3.0" }
},
"dnxcore50": {}
}
我正在使用 project.json 中定义的默认命令通过 Kestrel 运行项目.
I'm running the project through Kestrel with the default command defined in project.json.
"kestrel": "Microsoft.AspNet.Hosting --server Kestrel --server.urls http://localhost:5001"
一切正常.该项目运行并且依赖项运行良好.我唯一不明白的是谁决定使用哪个底层框架?
Everything works fine. The project runs and the dependency works well. The only thing I don't understand it who decides on which underlying framework to use?
据我所知,如果 Kestrel 使用 dnxcore50,该项目应该会失败.如果是这样,我们如何推动 Kestrel 使用它?
As far as I understand the project should fail if Kestrel uses dnxcore50. If that is the case how do we push Kestrel to use it?
顺便提一下,该项目运行良好,完全没有错误,但是当我尝试使用 DNU 手动构建项目时,出现以下错误.在这一点上,我认为它并不重要,因为就我所见,它不会在运行时导致故障.只是想添加它以防万一.
Just as a side note, the project runs pretty good with no errors at all, but when I try to manually build the project with DNU I get the error below. I don't consider it critical at this point, as it does not cause a failure during run time as far as I can see. Just wanted to add it in case it helps.
推荐答案
在 Visual Studio 2015 中,使用的框架按以下顺序确定:
In Visual Studio 2015, the framework used is determined in this order:
项目属性.在解决方案资源管理器中右键单击 .xproj 并选择属性.前往应用程序"部分(默认),您可以使用特定的 DNX 版本",包括版本、平台和架构.
The project properties. Right-Click the .xproj in your Solution Explorer and select Properties. Head to the "Application" section (the default), and you can "Use Specific DNX version", including version, platform, and architecture.
global.json.不知道这里能不能换平台,但是比如:
The global.json. I don't know if the platform can be changed here, but for example:
"sdk": {
"version": "1.0.0-beta6-12032"
}
Visual Studio 默认使用特定的运行时,具体取决于其版本.我相信 VS 2015 RC 默认使用 beta4、.Net Framework、x64.
Visual Studio uses a specific runtime by default depending on its version. I believe that VS 2015 RC uses beta4, .Net Framework, x64 by default.
从命令行运行时,它由您的活动 dnvm
决定.您可以使用命令 dnvm list
来显示已安装的 VM.您将获得类似于以下内容的列表:
When running from the command line, it's determined by your active dnvm
. You can use the command dnvm list
to display your installed VMs. You'll get a list similar to the following:
Active Version Runtime Architecture Location Alias
------ ------- ------- ------------ -------- -----
1.0.0-beta4 clr x64 C:UsersMatt.dnx
untimes
1.0.0-beta4 clr x86 C:UsersMatt.dnx
untimes
1.0.0-beta4 coreclr x64 C:UsersMatt.dnx
untimes
1.0.0-beta4 coreclr x86 C:UsersMatt.dnx
untimes
1.0.0-beta4-11566 clr x86 C:UsersMatt.dnx
untimes
1.0.0-beta5-11855 clr x64 C:UsersMatt.dnx
untimes
1.0.0-beta5-11855 clr x86 C:UsersMatt.dnx
untimes
1.0.0-beta5-11855 coreclr x64 C:UsersMatt.dnx
untimes
1.0.0-beta6-11921 clr x64 C:UsersMatt.dnx
untimes
1.0.0-beta6-11921 clr x86 C:UsersMatt.dnx
untimes x64
1.0.0-beta6-12005 clr x64 C:UsersMatt.dnx
untimes
1.0.0-beta6-12005 clr x86 C:UsersMatt.dnx
untimes
* 1.0.0-beta6-12032 clr x64 C:UsersMatt.dnx
untimes default
1.0.0-beta6-12032 clr x86 C:UsersMatt.dnx
untimes
*
表示您当前的 VM.coreclr
使用 dnxcore50
,其他的(可能是 Mac 上的 mono
)使用相应的框架,但似乎编译为 dnx451代码>.
The *
indicates your current VM. coreclr
uses dnxcore50
, and the others (likely mono
on your Mac) use the corresponding framework, but seem to compile as dnx451
.
这篇关于Kestrel 跑哪个框架?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!