0

Title says it all.

Wikipedia:

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.

emphasis added.

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

see also:

Running PowerShell from .NET Core

Running a PowerShell script in Mono?

Do PowerShell scripts run under Mono?

Thufir
  • 7,241
  • 18
  • 103
  • 236
  • 1
    powershell 6 does run on .NET Core – 4c74356b41 Feb 17 '18 at 18:54
  • 1
    Your Wikipedia quote answers the question in the title, so it sounds like the remaining question is about invoking Mono. Can you clarify what you mean by "invoke `Mono`"? – mklement0 Feb 17 '18 at 19:15
  • I'll try to find the source, @mklement0. It was `C#` in relation to `powershell`, as I recall. (versus `mono` and `powershell core`.) – Thufir Feb 18 '18 at 00:32

1 Answers1

3

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

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.

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 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.

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.

Bacon Bits
  • 26,878
  • 5
  • 51
  • 60