Skip to content

Groundwork for PowerShell Standard - #3095

Closed
Jason Shirk (lzybkr) wants to merge 4 commits into
PowerShell:masterfrom
lzybkr:portable-modules
Closed

Jason Shirk (lzybkr) wants to merge 4 commits into
PowerShell:masterfrom
lzybkr:portable-modules

Conversation

@lzybkr

Copy link
Copy Markdown
Contributor

Added a document describing the issues with portable modules and the
need for facade assemblies.

Also added the basis for a new reference assembly that can support cross
platform modules that target V3 and up.

@vors

Copy link
Copy Markdown
Collaborator

I think you should include some kind of deprecation mark in https://github.com/PowerShell/PowerShell/tree/master/docs/cmdlet-example#building-a-c-cmdlet
and put a cross link to this new doc.

Question: when you target netstandard1.3 (or 1.6) dotnet will make sure that all APIs you are using exists in both 4.5.1 and dotnet core 1.3, correct? Does it controvert with the passage about frontend assemblies that are not shipped in windows?

@lzybkr

Copy link
Copy Markdown
Contributor Author

You can see the netstandard version table here.

The basic idea is to target the lowest version of netstandard that you can. I chose 1.3 because it was quickest to get building, but we should really target 1.1 because PowerShell V3 will be running on systems without net46.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should change this to:

Recommendation is to build modules that targets both Windows PowerShell and PoweShell Core.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't recommend it yet - at least not until there is a good solution around facade assemblies.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe have a small blurb:

.Net Standard is a formal specification of .Net APIs available across all conforming .Net runtimes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about downlevel?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know and don't have clean VMs handy that I can check.

It's relatively straight forward to enumerate assemblies in the GAC to see which are facade assemblies - I'd do that on a clean VM for each OS of interest - just make sure Visual Studio hasn't been installed - it might install some of these facade assemblies.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps it makes sense to include a list of Open Issues which includes downlevel and facade assemblies which we can research later rather than block this PR

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: choose

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a general problem for anyone developing against .Net Standard using CoreClr and wanting to deploy onto FullClr. Is there any guidance from dotnet?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a general problem for folks building libraries or most applications - it's really only a problem for folks building extensions to applications.

Libraries should target netstandard - then the library works on most runtimes.

Applications (.exe) deploy the facade assemblies they know they need - the build system actually copies the facade assemblies along side the application binaries.

The problem only exists for extensible applications. The extensions can depend on assemblies that didn't exist when the application was built - but it's more or less expected that the application has those assemblies (for sharing purposes).

This is why msbuild is including some common facade assemblies so task dlls just work.

@richardszalay

Copy link
Copy Markdown

Jason Shirk (@lzybkr) Is there an indicative timeline for when the netstandard version of System.Management.Automation will be made available? It doesn't appear to be on nuget.org, listed or otherwise.

@tintoy

Copy link
Copy Markdown

If it helps at all, I've found that it can be installed from https://dotnet.myget.org/F/dotnet-core/api/v3/index.json.

@tintoy

Copy link
Copy Markdown

Oops! Fat fingers :-/

<?xml version="1.0" encoding="utf-8"?>
<configuration>
 <packageSources>
    <!-- .NET Core nightlies (required by Powershell Core) -->
    <add key="netcore-nightlies" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
    <!-- Powershell Core -->
    <add key="powershell-core" value="https://powershell.myget.org/F/powershell-core/api/v3/index.json" />
 </packageSources>
</configuration>

@richardszalay

Copy link
Copy Markdown

Adam Friedman (@tintoy) Thanks! I think I'll wait for a release I can publish to the gallery with, though.

Added a document describing the issues with portable modules and the
need for facade assemblies.

Also added the basis for a new reference assembly that can support cross
platform modules that target V3 and up.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps it makes sense to include a list of Open Issues which includes downlevel and facade assemblies which we can research later rather than block this PR

@SteveL-MSFT Steve Lee (SteveL-MSFT) added the Review - Committee The PR/Issue needs a review from the PowerShell Committee label Mar 9, 2017
@SteveL-MSFT

Copy link
Copy Markdown
Member

@PowerShell/powershell-committee needs to review this to see what we would have in the reference assembly

// Methods
protected internal override bool ShouldRun(System.Management.Automation.CommandInfo commandInfo, System.Management.Automation.CommandOrigin origin, System.Management.Automation.Host.PSHost host, out System.Exception reason) { reason = default(System.Exception); return default(bool); }
}
#if SNAPINS

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove the SnapIn APIs as it's not forward compatible

public static string XmlNodeList(System.Management.Automation.PSObject instance) { return default(string); }
}
}
namespace Microsoft.PowerShell.Cim {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CIM is primarily used by WMI and doesn't have much usage on Linux/Mac via OMI. I recommend we remove this to align with future direction of being CIM-less.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caveat: we want the first iteration of this to be the most minimal surface area. At a point in the future, if we were to add CIM support, we could re-add this to a later version of this API.

// Methods
protected override void ProcessRecord() { }
}
[System.Management.Automa

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need MMI if we don't need CIM

@joeyaiello

Copy link
Copy Markdown
Contributor

Jason Shirk (@lzybkr) I know we're not finished here, but would you mind pushing what you've got so far to this branch? I'd like to pull it up during my presentation in a couple days. Thanks!

@joeyaiello Joey Aiello (joeyaiello) changed the title Groundwork for portable modules Groundwork for PowerShell Standard May 31, 2017
@lzybkr

Copy link
Copy Markdown
Contributor Author

This doesn't need to be merged.

Someone on the team will pick up the remaining work of creating the PowerShell Standard reference assemblies based on this work.

@lzybkr
Jason Shirk (lzybkr) deleted the portable-modules branch October 31, 2017 21:11
@SteveL-MSFT Steve Lee (SteveL-MSFT) removed Review - Committee The PR/Issue needs a review from the PowerShell Committee Review - Needed The PR is being reviewed labels Aug 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants