打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
从Mono、.NET Core 说起(下)


来源:田园里的蟋蟀

链接: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”了,期待吧!


本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
Getting Started with the LLVM System — LLVM 16.0.0...
Introducing xdebug
使用Visual C++编译GALib(静态库)
Docker编排工具调研:Rancher – 陈飞 – 码农
SharpVectors
Yocto Project Overview and Concepts Manual
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服