Closed patware closed 5 years ago
How are you using this library? In a standalone application or within a PowerShell session?
Standalone application.
Tried 4 scenarios:
Details:
This is a shim library that’s only made to run within PowerShell itself. It’s used for create cross-platform/cross-powershell version cmdlets and such.
What you want to leverage is the PowerShell SDK: https://www.nuget.org/packages/Microsoft.PowerShell.SDK/7.0.0-preview.1
This has the actual PowerShell bits inside and PowerShell.Create will work as expected.
Understood...
Just curious... Is the following statement from the Readme still valid:
PowerShell Standard.Library Version 5.1 This allows you to create PowerShell modules and host which will run on PowerShell Version 5.1 and later including PowerShellCore
It’s technically true… with a typo. You can write a PowerShell host that will run on PowerShell 5.1 and later. That’s what we do in https://github.com/PowerShell/PowerShellEditorServices
We’re so good at overloading terms…
I can update the doc to be more explicit.
I’ve opened #64 with an explicit note on not using this for standalone apps
.Net Standard 2.0 PowerShellStandard.Library Version 5.1.0
The PowerShell.Create() returns null.
Tried also with PowerShell.Create(RunspaceMode.NewRunspace), same result.