从 Mono、.NET Core 说起(下)

2016-5-26 | 发布者:DotNet

(点击上方蓝字,可快速关注我们)


来源:田园里的蟋蟀

链接:http://www.cnblogs.com/xishuai/p/mono-dotnetcore.html 


7. The relationship between .NET Core(corefx, CoreCLR) and XRE


我们先来看一下,微软在写那篇文章的时候所列出的一些计划:


  • More libraries. Consider the subset we have today a down-payment on what is to come. Our goal is to open source the entire .NET Core library stack by Build 2015.


  • Building and running on non-Windows platforms. We currently only provide the ability to build and run on Windows. We intend to build a public working group between us and the Mono community once we have enough code out there.


  • .NET Core Runtime (CoreCLR). We’re currently figuring out the plan for open sourcing the runtime. Stay tuned!


再来看一下现在完成的进度:


  • corefx:This repository contains the foundational libraries that make up the .NET Core development stack.


  • Roslyn:The .NET Compiler Platform (“Roslyn”) provides open-source C# and Visual Basic compilers with rich code analysis APIs.


  • XRE:The .NET Cross-Platform Runtime SDK (.NET XRE) contains the code required to bootstrap and run an application, including the compilation system, SDK tools, and the native CLR hosts.


  • ….


对比计划和开源的项目,你可以往上面套一套了,首先,.NET Core 包含 .NET Core Framework(corefx,部分完成)和 .NET Core Runtime(CoreCLR,暂无),Roslyn 为跨平台的编译器,XRE 是什么?它是不是微软未完成的 CoreCLR,其实并不是的,我们再来看开发者提给微软的一些问题。


1. 链接地址:.NET Core Runtime


I’ve wanted to learn about the .NET runtime for a while and have tried studying Rotor and the spec but haven’t gotten very far. I was thinking of retrying with the .NET Core runtime but I can’t seem to find it in the GitHub repository.


:Excellent question. It is really two questions.


  • Where/when is CoreCLR? It is in a private repo on GitHub, but it isn’t ready yet. We’ll switch to public in the first part of next year. The team is focussed on making this happen.


    We’ve been thinking about how to make it easy for folks to learn about the runtime, in order to understand the code and make quality PRs. We have a bunch of internal documentation that we were thinking about making available in a WH wiki. Sound like a good idea?


  • We have a bunch of requirements that are really important to satisfy. On another thread in the forums here, we’ve been talking about the relationship between .NET Core and the .NET Framework. We need an efficient way to flow code back and forth between .NET Core and the .NET Framework. Getting that right takes time, but will also pay dividends and allow us to take PRs more efficiently once we go public.


We had some of that infrastructure in place when we released the corefx repo, but we learned that it wasn’t quite enough. We’re taking more time upfront with the coreclr repo.


I’m glad to hear that you and others are excited to see the coreclr repo show up. We are too.


解读:这个提问者很犀利,直接问为什么在 GitHub 上,找不到 .NET Core Runtime 的项目,原来它被藏起来了(Private),还没有被开放出来,微软正在加紧时间开发这个东西(最重视的项目),后面说明了 .NET Core and the .NET Framework 之间的关系,目前 corefx 是 .NET Core 的部分实现,等到 coreclr 正式发布出来,才可以说它是完整的。


2. 链接地址:.NET Core CLR Questions!


Can I embed .NET Core and invoke the runtime like I can with “Embedded Mono”?


:The CLR has had a public hosting API since its inception. SQL Server and IIS are great examples of CLR hosts. CoreCLR also has a hosting API, which ASP.NET 5 uses. This will be included in the CoreCLR repo, when it shows up.


Will .NET Native be open sourced as well so we could port it to other platforms and CPU types? (This would be important to compile .NET on iOS).


:Right now, we are focussed on CoreCLR. I can imagine .NET Native following. Right now, CoreCLR has all of our attention, so we’ll re-visit the .NET Native question after we’ve got CoreCLR on GitHub.


解读:第一个问题是,现在能不能像 Mono 一样启动 .NET Core,答案是如果使用 ASP.NET 5 是可以的,因为 ASP.NET 5 已经实现了,那就是 XRE,但 XRE 并不是 CoreCLR,它只是 CoreCLR 的一部分(included),第二个问题的答案在后半部分,我没有贴出来,但这部分答案会让你对 CoreCLR 有所期待,微软正在集中力量去开发它,我们只能期待它早点正式发布。


8. 有关 .NET 开源的一些其他疑问(来自文章评论)


1. 问Does this mean yes or no to open-sourced WPF?


:We currently don’t plan on open sourcing the client stacks, which includes Windows Forms as well as WPF.


暂时没有计划开放 Windows Forms、WPF 源代码,是不是意味着被抛弃?


2. 问Will I ever be able to run Visual Studio on Linux?


:I’m not working for Visual Studio but I haven’t heard of any plans to offer a cross-platform version of Visual Studio itself.


其实我还想问下 on Mac?呵呵,多希望回答的是 Absolutely,但是还是很期待微软可以实现跨平台的 Visual Studio,这样才真正是宇宙最强大的 IDE!


3. 问Is there a roadmap to “upgrade” WPF to .Net Core 5?


:There are currently no plans to port either WinForms or WPF to .NET Core.


和第一个问题一样,微软没打算把 WinForms 和 WPF 的代码添加到 .NET Core 中。


4. 问does anyone know is plain old WCF a part of CORE?


:The client side of WCF will be included in .NET Core.


和 WinForms、WPF 相反,WCF 的代码将会被添加到 .NET Core 中。


5. 问Immo, ok so all of this is leaving me a bit confused.What does all of this mean for me as an LOB developer?


:The key difference is that .NET Core will be a single, cross platform stack.


Let’s contrast this with .NET Framework and Mono today. Mono is a full reimplementation of the .NET Framework. This means that certain features aren’t supported or implemented differently enough to cause behavioral changes that can break your application. Also, Microsoft doesn’t support running on Linux or MacOS today.


.NET Core on the other hand will be supported by Microsoft on Windows, Linux and MacOS. We’ll have a single code base that we plan on working on together with the Mono community.


For you that means that targeting other platforms will be more reliable and innovation will happen faster. It also means that you’ll be able to find out sooner what’s coming next because all the design work is happening in public.


Finally, you’ll also be able to take a look at the kitchen and engage in design discussion.


这个回答有点啰嗦,主要强调了 Mono 的贡献,然后再拉着 Mono 一块做单一的跨平台 .NET Core,最后就是过程开放。


插一段:including the entire CoreCLR runtime (JIT, GC, etc) as well as a set of class libraries. 可以看出 .NET Core 大致包含哪些东西。


6. 问Will everything eventually have an MIT license? Or the Apache 2.0 license? Does it now? I’m confused.


:Your confusion is very understandable. Some of the .NET open source projects (such as Roslyn) use Apache 2.0. Newer projects (such as .NET Core) use the MIT license. Both licenses are OSI approved open source licenses so either one is indicative of OSS.


Moving forward, we plan on exclusively using the MIT license. I don’t know whether we’ll switch the existing projects from Apache 2.0 to MIT.


这个是关于开源协议的,我们可以通过查看开源项目中,比如类文件的最上面有协议说明,ASP.NET 中大部分项目都是基于 Apache 2.0,最新的开源项目(比如 corefx)是基于 MIT,不知道这两个协议有什么不同,看作者的意思,微软是想把 Apache 2.0 协议转到 MIT 下,不知道可不可行。


7. 问WebForms on Linux and Mac OS?


:We’re making the .NET Core Framework cross plat, not the .NET Framework and .NET Core doesn’t include WebForms.


很简单,No。


8. 问does this mean, i will be able to run .net desktop apps on linux, without the original developer having to port to mono?


:We currently don’t plan to open source the client technologies (WinForms, WPF), nor taking them cross plat. So I’m afraid the answer would be no.


很简单,No plan。


9. 问What is the relation between .NET Core and .NET Native?


:.NET Native is two things: it’s a tool chain that pre-compiles IL to native and it’s a runtime that executes that code. .NET Core is CLI compliant stack that runs both, JIT based applications (via CoreCLR) as well as ahead-of-time compiled (AOT) applications (produced by .NET Native).


这真是一个好问题,什么是 .NET Native?它最大的特点,是可以直接将应用程序代码编译成本地机器码,这是和 .NET Core 最大的区别,所以作者提到了 CLI compliant,这部分在上面 Mono 中有说明。


10. 问You said that the client side of WCF will be included in .NET Core. What about the server side of WCF? I mean .NET Core will be a Server side technology if I understand correctly


:That’s an execellent question for the WCF team. I’ll forward that question.


这个上面有个问题搞错了,“client side of WCF will be included in .NET Core”,注意是 Client,而并不是 Server,这个两个不同的概念,Client 的作用就是为了兼容之前开发的 WCF 项目。


11. 问.NET Core Runtime is the same runtime which .NET Framework uses?


:.NET Core has two runtimes: CoreCLR and .NET Native.


CoreCLR isn’t identical to the CLR but it’s very close. The key pieces are virtually identical, so same GC, same JIT, same type system etc.


In .NET Native, it’s obviously a lot more different as .NET Native doesn’t have a JIT, but the GC, for example, is the same.

How close is .NET Core Runtime to Mono Runtime?


They are different implementations, done by different people. But both implement the same ECMA CLI standard, so they are quite similar in what they do, but most likely not in how they do it.


好问题,好回答,CoreCLR 和 .NET Native 是完全不同的模式,.NET Native 因为直接可以讲程序代码编译成本地机器码,所以根本不需要 JIT,另外一个问题是 .NET Core Runtime 和 Mono Runtime,首先他们是不同的实现,但他们都是基于 ECMA CLI(公共语言基础),他们的相似之处都是将 CIL 编译成本地机器码。


前段时间,dudu 写了一篇这样的博文:挡不住的好奇心:ASP.NET 5是如何通过XRE实现跨平台的,最后产生了这样一个疑问:在 Core CLR 被加载,Microsoft.AspNet.Hosting 被执行之后,为什么还要用 Mono Runtime 加载一些 dotnet.host 相关的程序集?为什么不直接用 Core CLR 加载呢?


其实 XRE 并不是真正的 .NET Core Runtime,可以说是它的一部分,或者是一个先行版本,为什么要借助 Mono Runtime?很简单,因为 .NET Core Runtime 并不完善,我相信微软和 Mono 社区现在正在加紧完善这个最重要的项目 coreclr,至于 .NET Core Framework(corefx)的开发,有了微软的 Windows .NET Framework 和 Mono 自行实现的跨平台 .NET Framework,其实移植到 corefx 的难度并不大,重要的还是 coreclr,请注意这个链接地址:https://github.com/dotnet/coreclr,说不准过几天就不是“404”了,期待吧!


【今日微信公号推荐↓】


更多推荐请看值得关注的技术和设计公众号


其中推荐了包括技术设计极客 和 IT相亲相关的热门公众号。技术涵盖:Python、Web前端、Java、安卓、iOS、PHP、C/C++、.NET、Linux、数据库、运维、大数据、算法、IT职场等。点击《值得关注的技术和设计公众号》,发现精彩!



热门文章

更多

私房话

遇过渣男离过婚,做过战地记者也做女主播,但她...

遇过渣男离过婚,做过战地记者也做女主播,但她...

对于女人来说,从咿呀学语的平民孩童到民众称赞的尊贵王妃,可能是最惊艳的人生逆袭了。1972年9月15日,当这个叫莱蒂西亚的小姑娘出生时,谁也不会想到,有朝一日她会成为一国之母。25岁之前,她有着跟你一样的...
心灵鸡汤吧 • 
婆媳关系中非常重要的小细节,你的老公做对了吗...

婆媳关系中非常重要的小细节,你的老公做对了吗...

1、不要有“天下无不是的父母”这个观念  很多老公们似乎都有这种观念,并且喜欢将这句话挂在嘴边,以示他们对父母的尊崇和“顺孝”。尤其在老婆受了老妈的委屈后,这句话出现的频率是最高的:天下无不是的父...
教你做聪明的女人 • 
一个很穷的大学生,和女朋友进了宾馆,然后..

一个很穷的大学生,和女朋友进了宾馆,然后..

一个21岁的小伙子,在一所大学上大二,家境一般的他,没有勤工俭学,学习成绩也不够名列前茅,没有收入,靠父母每月提供的生活费开销。现在社会的诱惑太大了,我们都在红尘中,怎能幸免。他的日子过的还是挺遐逸...
女人心計学 • 
为什么很多男人遇见她,就是想跟她上床!

为什么很多男人遇见她,就是想跟她上床!

几天前一个美女跟我怒气冲冲地抱怨说,很多男人遇见她,就是想跟她上床!  我说:“那是对的!”  她问:“什么?你还替他们说话?”  我说:“哈哈,你每天都只是注重你的外表,穿着、打扮、性感、漂亮!他们...
女人那点事 • 
男人绝对不会告诉你的一些事,聪明女人一定要知...

男人绝对不会告诉你的一些事,聪明女人一定要知...

1、 女人爱等男人的电话。男人不会守着电话等你打来。别信他说什么手机没电,千万记住:如果想你了,就算没手机,他也会爬上屋顶嚷嚷,让你知道。2、 女人一恋爱就忍不住往终身大事上联想。男人恋爱首先不是为了...
教你看透男人心 • 
加载更多

 更多私房话