问题描述
我们有,说.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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!