Repository navigation
Ensure nuget based reference assemblies are created for PowerShell #1152
Description
Activity
- addedWG-Maintainers-Buildspecific to affecting the buildspecific to affecting the build
on Jun 20, 2016 andyleejordan commented
on Jun 20, 2016 MemberMore actionsWhat about the existing one, Microsoft.PowerShell.5.ReferenceAssemblies? This is what our cmdlet-example compiles against.
raghushantha commented
on Jun 20, 2016 MemberAuthorMore actionsExisting one stays. We need to have a newer version of the SDK for every release.
Reacted by Joel Bennettandyleejordan commented
on Jun 20, 2016 MemberMore actionsAre we changing the API?
andyleejordan commented
on Jun 20, 2016 MemberMore actionsHm, 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 commented
on Jun 20, 2016 MemberAuthorMore actionsJames Truher (@JamesWTruher) to answer below:
"How were the original ones built?"We are going to need updated (for .NET Core) reference assemblies, and it's blocking #1234.
- assigned and unassigned
on Jul 2, 2016 Our reference assemblies will have dependencies on WSMan and MMI assemlbies. We should look, can we turn them into references as well. #1105
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.Reacted by Andy Jordan51 remaining items
hey Steve Lee (@SteveL-MSFT) - Any update on this?
Jon Kohler (@JonKohler) sorry, had tweeted it, but forgot to update here https://www.nuget.org/packages/PowerShellStandard.Library/5.1.0-preview-01
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.Jsonoh, nevermind, figured it out. Needed to add -Version or else it doesn't work:
nuget install PowerShellStandard.Library -Version 5.1.0-preview-01
Reacted by Joel BennettSteve 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) unfortunately for now, PSStdLib is tied to dotnetstd 2.0.
what's the github issue we can track to see the cmdlet tied to new sdk?
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.
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
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.
Is this meant to be a replacement of Microsoft.PowerShell.5.1.ReferenceAssemblies?
This is for developers using our SDK