Powershell Core是否可以在.NET Core上运行? [英] Does Powershell Core run on .NET Core?

查看:169
本文介绍了Powershell Core是否可以在.NET Core上运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

标题说明了一切.

维基百科:

最初仅是Windows组件,称为Windows PowerShell,它 于2016年8月18日成为开源和跨平台的 PowerShell Core的介绍.[4]前者建立在.NET之上 .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.正确吗?

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

另请参阅:

从.NET Core运行PowerShell

在Mono中运行PowerShell脚本?

PowerShell脚本是否在Mono下运行?

推荐答案

据我回忆,Powershell Core应该能够有效地调用Mono.正确吗?

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

无论您说的是什么,我暂时都对此表示怀疑.能否使用.Net Core编译为Mono编写的非平凡代码,反之亦然?也许,但并非总是如此.是否可以使用.Net Core加载为Mono编写的库,反之亦然?使用.Net Core 2.0,您应该能够做到这一点,比Beta不到一年(就像PowerShell Core不到Beta一样不到一个月).因此,也许,但并非总是如此.您可以将Add-Type与Mono代码一起使用并期望它运行吗?也许可以,但是您将使用.Net Core而不是Mono进行编译.

Whatever you mean by this, I doubt it for the time being. Can you compile non-trivial code written for Mono with .Net Core and vice-versa? Maybe, but not always. Can you load libraries written for Mono with .Net Core and vice-versa? With .Net Core 2.0 you're supposed to be able to do that that's less than a year out of beta (just like PowerShell Core is less than a month out of beta). So, again, maybe, but not always. Can you use Add-Type with Mono code and expect it to run? Maybe, but you'll be compiling it with .Net Core, not Mono.

如果您的意思是从PowerShell Core,调用巧合使用Mono编写的已编译程序".是的,您可以随时这样做.这是壳.您可以使用它来运行外部程序.

If you mean "From PowerShell Core, call a compiled program which coincidentally was written using Mono." In that case, yeah, you can always do that. It's a shell. You can run external programs with it.

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

Mono and .Net Core are two implementations of the .Net CLR that run on Linux, but they're not guaranteed to always be compatible and they don't implement an identical set of namespaces. .Net Core code isn't even necessarily compatible with .Net Framework source code. It's best to think of them as different implementations of the same language, like Visual C++ vs GNU C++, or IBM Java vs Oracle Java.

随着时间的流逝,它们将融合为一个单一的CLR标准(.Net标准)的支持者,但是我们才刚刚开始. .Net Core 1.x太准了. .Net Core 2.0大量涌现,但仍非常非常早. Mono现在是MS产品,但是有些组件可能不会混用. Mono和.Net Core(以及.Net Framework和Unity)最终应该支持.Net标准,这是一种EMCA标准,但它们绝不是100%相同的.我怀疑当我们到达.Net Core 4左右时,我们将拥有".Net Core",它实现了.Net Standard的所有功能,然后实现了".Net Windows Framework"作为扩展,其中包含了原始版本中缺少的内容. Net Framework,也许还有一个".Net Linux Framework",可以在Linux上做同样的事情.

As time goes on, they will converge into a supporting a single CLR standard (.Net Standard), but we're at the start of that journey. .Net Core 1.x was very bare-bones. .Net Core 2.0 fleshes out a ton, but it's still very, very early. Mono is now a MS product, but there may be components that just don't mix. Mono and .Net Core (and .Net Framework and Unity) are eventually supposed to support .Net Standard which is an EMCA standard, but they're never intended to be 100% identical. I suspect that when we get to .Net Core 4 or so, we'll have ".Net Core" which implements everything from .Net Standard and then a ".Net Windows Framework" as an extension with the missing stuff from the original .Net Framework and maybe a ".Net Linux Framework" to do the same sort of things on Linux.

这篇关于Powershell Core是否可以在.NET Core上运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆