.NET Core 上是否有 Powershell Core 运行?

Does Powershell Core run on .NET Core?

标题说明了一切。

维基百科:

Initially a Windows component only, known as Windows PowerShell, it was made open-source and cross-platform on 18 August 2016 with the introduction of PowerShell Core.[4] The former is built on .NET Framework while the latter on .NET Core.

添加了重点。

据我回忆,Powershell Core 应该 能够有效地调用 Mono。对吗?

另见:

Running a PowerShell script in Mono?

Do PowerShell scripts run under Mono?

From what I recall reading, Powershell Core should be able to invoke, effectively, Mono. Is that correct?

不管你说的是什么意思,我暂时怀疑。您可以使用 .Net Core 和 vice-versa 编译为 Mono 编写的 non-trivial 代码吗?也许,但并非总是如此。您可以使用 .Net Core 和 vice-versa 加载为 Mono 编写的库吗?使用 .Net Core 2.0,您 应该 能够在测试版发布不到一年的时间内做到这一点(就像 PowerShell Core 测试版发布不到一个月一样)。所以,也许,但并非总是如此。您可以将 Add-Type 与 Mono 代码一起使用并期望它成为 运行 吗?也许吧,但您将使用 .Net Core 而非 Mono 对其进行编译。

如果你的意思是 "From PowerShell Core, call a compiled program which coincidentally was written using Mono." 在那种情况下,是的,你总是可以这样做。这是一个shell。您可以使用它 运行 外部程序。

Mono 和 .Net Core 是 运行 在 Linux 上的 .Net CLR 的两个实现,但不能保证它们始终兼容并且它们不实现相同的集合命名空间。 .Net Core 代码甚至不一定与 .Net Framework 源代码兼容。最好将它们视为同一语言的不同实现,例如 Visual C++ 与 GNU C++,或 IBM Java 与 Oracle Java。

随着时间的推移,它们将汇聚成一个支持单一的 CLR 标准(.Net 标准),但我们才刚刚开始这个旅程。 .Net Core 1.x 非常 bare-bones。 .Net Core 2.0 充实了很多内容,但它仍然非常非常早。 Mono 现在是 MS 产品,但可能有些组件无法混合。 Mono 和 .Net Core(以及 .Net Framework 和 Unity)最终应该支持作为 EMCA 标准的 .Net Standard,但它们从未打算 100% 相同。我怀疑当我们到达 .Net Core 4 左右时,我们将拥有“.Net Core”,它实现了 .Net Standard 的所有内容,然后是“.Net Windows Framework”作为缺少内容的扩展来自原始的 .Net Framework,也许还有一个“.Net Linux Framework”,可以在 Linux.

上做同样的事情