What does "Windows Powershell compatibility (.net standard 2.0)" mean?

Viewed 868

I was looking for a way to execute Powershell cmdlets in .net standard 2.0, but finally figured out that it's impossible because powershell is built with .net framework or .net core for powershell core.

During my researches I discovered this : https://github.com/PowerShell/PowerShell/projects/4

If it's impossible to execute powershell in .net standard, what does this project stands for ?

1 Answers

what is net standard :

.Net Standard is a specification which defines a set of APIs which the .Net platform has to implement. It is not another .Net platform though. You can only build libraries, not executables with it. On the following screenshot, you can see that .Net Standard contains APIs from the classic .Net framework, .Net core and Xamarin.

So you can build libraries against a standard that ensures it'll run either under net framework, or net core, or Xamarin. This is reasoned in the fact that the defined (in the standard) set of classes, interfaces, etc. are implemented by before mentioned frameworks. With increasing net standard versions the amount of supportex classes, interfaces increases.

Since Powershell is not a library, you've to choose between Powershell 5.x ( using net framework) or Powershell 6 (= using net core). Since you can invoke C# Libraries from Powershell, a library implementing net standard can be invoked from Powershell 5 and from Powershell 6.

Related