You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Ensure nuget based reference assemblies are created for PowerShell #1152
Hm, we have introduced some PowerShell script variables to the language ($IsWindows, $IsLinux, $IsOSX), but I don't think we've changed the public C# API of the PowerShell classes.
It would probably be better to build reference assemblies out of PowerShell Core. How were the original ones built?
MMI and WSMan packages need to have implementation DLLs in them. We won't open source them, so we need the full nuget package to support the WSMan module and WMI/CIM in PowerShell.
As for SMA, I think we also need the full nuget package published eventually, at least for the netstandard1.6 target framework. A third party .NET Core application should be able to host the PowerShell Core SMA.dll, and a full package is required in order to do that.
Steve Lee (@SteveL-MSFT) sorry if this is obvious -- how to install via the 'nuget' CLI? For some reason Install-Package didn't work but nuget does. E.g. nuget install Newtonsoft.Json
Steve Lee (@SteveL-MSFT) another problem -- I noticed the reference assembly installed was net standard 2.0, not 4.5. Thus it didn't compile. What is the correct way to install the right framework?
error CS1070: The type `System.Object' has been forwarded to an assembly that is not referenced. Consider adding a reference to assembly `netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
Steve Lee (@SteveL-MSFT) so I see that I was supposed to pass in "-sdk:2" flag to 'mcs' compiler to make this work. However, my library uses 'dynamic' language feature, which is not supported in 2.0.
I mean, there must be a way to use the 5.1.0 preview on other release versions, isn't there?
Not Vitalik Buterin (@mallochine) - SteveL said "for now" but it's just to be clear: this isn't really just "for now" -- if you want to write cmdlets that target PowerShell Core, you can't use features that aren't in netstandard2.0. In fact, you must compile targeting .NET Standard 2.0
Additionally, any Windows machines will need at least .NET Framework 4.6.1 (and possibly 4.7, depending on features you use) if you want to be sure the module will work in full desktop "Windows PowerShell" ...
You can cross-compile (producing separate assemblies targeting each framework), but your code still has to compile against .NET Standard 2.0 to work in PowerShell Core.
Is this truly based on PowerShell 5.1? Or is this just renamed from the original PowerShell 3 version? I don't see SMA.Runspace.CreatePipeline() for instance.
@darkonejr PowerShell Standard Library intends to always be forward compatible. As such, PS Std Lib v3 is a subset of PS v3 where the apis still exist in PSCore6. Similarly , PS Std lib v5.1 is a subset of PS v5.1 where the apis still exist in PSCore6 (essentially, some exceptions). I would expect CreatePipeline() to still be there. If its not, it's probably a bug in the preview. I would suggest opening a new issue for any APIs you expect to be there, but aren't.
Activity
andyleejordan commentedon Jun 20, 2016
What about the existing one, Microsoft.PowerShell.5.ReferenceAssemblies? This is what our cmdlet-example compiles against.
raghushantha commentedon Jun 20, 2016
Existing one stays. We need to have a newer version of the SDK for every release.
andyleejordan commentedon Jun 20, 2016
Are we changing the API?
andyleejordan commentedon Jun 20, 2016
Hm, we have introduced some PowerShell script variables to the language (
$IsWindows,$IsLinux,$IsOSX), but I don't think we've changed the public C# API of the PowerShell classes.It would probably be better to build reference assemblies out of PowerShell Core. How were the original ones built?
raghushantha commentedon Jun 20, 2016
James Truher (@JamesWTruher) to answer below:
"How were the original ones built?"
andyleejordan commentedon Jul 2, 2016
We are going to need updated (for .NET Core) reference assemblies, and it's blocking #1234.
vors commentedon Jul 3, 2016
Our reference assemblies will have dependencies on WSMan and MMI assemlbies. We should look, can we turn them into references as well. #1105
daxian-dbw commentedon Jul 3, 2016
MMI and WSMan packages need to have implementation DLLs in them. We won't open source them, so we need the full nuget package to support the WSMan module and WMI/CIM in PowerShell.
As for SMA, I think we also need the full nuget package published eventually, at least for the netstandard1.6 target framework. A third party .NET Core application should be able to host the PowerShell Core SMA.dll, and a full package is required in order to do that.
51 remaining items
JonKohler commentedon Mar 6, 2018
hey Steve Lee (@SteveL-MSFT) - Any update on this?
SteveL-MSFT commentedon Mar 6, 2018
Jon Kohler (@JonKohler) sorry, had tweeted it, but forgot to update here https://www.nuget.org/packages/PowerShellStandard.Library/5.1.0-preview-01
mallochine commentedon Mar 7, 2018
Steve Lee (@SteveL-MSFT) sorry if this is obvious -- how to install via the 'nuget' CLI? For some reason Install-Package didn't work but nuget does. E.g.
nuget install Newtonsoft.Jsonmallochine commentedon Mar 7, 2018
oh, nevermind, figured it out. Needed to add -Version or else it doesn't work:
nuget install PowerShellStandard.Library -Version 5.1.0-preview-01
mallochine commentedon Mar 7, 2018
Steve Lee (@SteveL-MSFT) another problem -- I noticed the reference assembly installed was net standard 2.0, not 4.5. Thus it didn't compile. What is the correct way to install the right framework?
mallochine commentedon Mar 7, 2018
Steve Lee (@SteveL-MSFT) so I see that I was supposed to pass in "-sdk:2" flag to 'mcs' compiler to make this work. However, my library uses 'dynamic' language feature, which is not supported in 2.0.
I mean, there must be a way to use the 5.1.0 preview on other release versions, isn't there?
SteveL-MSFT commentedon Mar 8, 2018
Not Vitalik Buterin (@mallochine) unfortunately for now, PSStdLib is tied to dotnetstd 2.0.
mallochine commentedon Mar 8, 2018
what's the github issue we can track to see the cmdlet tied to new sdk?
Jaykul commentedon Mar 8, 2018
Not Vitalik Buterin (@mallochine) - SteveL said "for now" but it's just to be clear: this isn't really just "for now" -- if you want to write cmdlets that target PowerShell Core, you can't use features that aren't in netstandard2.0. In fact, you must compile targeting .NET Standard 2.0
Additionally, any Windows machines will need at least .NET Framework 4.6.1 (and possibly 4.7, depending on features you use) if you want to be sure the module will work in full desktop "Windows PowerShell" ...
You can cross-compile (producing separate assemblies targeting each framework), but your code still has to compile against .NET Standard 2.0 to work in PowerShell Core.
mallochine commentedon Mar 9, 2018
Ok, so turns out actually .NET Standard and .NET Framework at different things. I finally got this to compile.
How do I install .NET Core 2.0 SDK from nuget? Since the library I used was deprecated -- https://www.nuget.org/packages/NETStandard.Library.NETFramework/2.0.0-preview2-25405-01
almostjulian commentedon Mar 9, 2018
Is this truly based on PowerShell 5.1? Or is this just renamed from the original PowerShell 3 version? I don't see SMA.Runspace.CreatePipeline() for instance.
SteveL-MSFT commentedon Mar 10, 2018
@darkonejr PowerShell Standard Library intends to always be forward compatible. As such, PS Std Lib v3 is a subset of PS v3 where the apis still exist in PSCore6. Similarly , PS Std lib v5.1 is a subset of PS v5.1 where the apis still exist in PSCore6 (essentially, some exceptions). I would expect CreatePipeline() to still be there. If its not, it's probably a bug in the preview. I would suggest opening a new issue for any APIs you expect to be there, but aren't.
LeonarddeR commentedon Mar 2, 2020
Is this meant to be a replacement of Microsoft.PowerShell.5.1.ReferenceAssemblies?