.Net Core是否生成与标准.Net相同的IL?

编程入门 行业动态 更新时间:2024-10-27 08:24:35
本文介绍了.Net Core是否生成与标准.Net相同的IL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我们有此公告,说.Net Core已重命名为1.0(令人困惑,但很好,随便什么)。 Hanselman在其中指出

We have this announcement that .Net Core is being renamed to 1.0 (confusing, but fine, whatever). In it Hanselman states

It doesn't yet support VB or F#.

这让我觉得我错过了一些东西。我的逻辑工作原理如下。

Which makes me think that I'm missing something. My logic works as follows.

使用C#来使用两个简单的简单Hello World应用程序,而VB来使用另一个应用程序。假设您保持简单,则在使用标准msbuild / .Net框架进行编译时,应该获得相同的IL。据我了解,您可以让.Net核心运行同一dll,因为它在该级别上全部为IL。那么为什么要说它不支持VB?它是否仅在简单情况下(您可能会参考vb专用的东西)不支持它?还是在为.Net Framework与.Net Core进行编译时生成的实际IL不同,并且还没有VB / F#编译器?

Take two simple simple Hello World apps one in C#, the other in VB. Assuming you kept it simple, when compiling with standard msbuild/.Net framework you should get identical IL. It is my understanding that you can then get .Net core to run that same dll since it's all IL at that level. So why say that it doesn't support VB? Is it that it doesn't support it beyond simple situations (where you'd likely reference vb-specific stuff)? Or is it that the actual IL generated when compiling for .Net Framework versus .Net Core is different and there isn't a VB/F# compiler around yet?

推荐答案

是的,它会生成相同的IL

Yes it generates the same IL

(我不能这么简单地回答它)

(I could not resist to answer it that simple)

不过,对于VB部分:关于VB支持:在.NET Core上运行需要编译器(在Roslyn中实现),CLI命令 dotnet-compile-vb (尚未为F#实施……目前社区已交付它)和受支持的 Microsoft.VisualBasic 版本(在corefx中实现)。我猜想VisualBasic支持的要点与例如ASP.NET SignalR。该代码在那里运行的是95%,但尚未经过官方测试和支持。

Nevertheless, to the VB Part: In regards of VB support: Running on .NET Core requires a compiler (implemented in Roslyn), a CLI command dotnet-compile-vb (not implemented ... for F# the community delivered it by now) and a supported version of Microsoft.VisualBasic (implemented in corefx). I guess the point of VisualBasic support is the same as for e.g. ASP.NET SignalR. The code is 95% there, it runs, but it is not officially tested and supported. It is a matter of timelines not of technologies.

恕我直言:考虑到 Microsoft.VisualBasic 组件在那里, IL是相同的,只要编译器使用基于System.Runtime的Core平台,理论上它甚至可以执行已编译的VB程序集。

IMHO: Considering that the Microsoft.VisualBasic assembly is there and the IL is the same, it could in theory even execute a compiled VB assembly as long as the compiler used the System.Runtime based Core platform.

PS May 2019:他们刚刚宣布要移植大部分VB .NET运行时

PS May 2019: they just announced to Port the majority of the VB .NET Runtime

更多推荐

.Net Core是否生成与标准.Net相同的IL?

本文发布于:2023-11-07 04:23:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1565563.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:标准   Net   Core   IL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!