Skip to content

Platform-aware Install-PSResource: filter runtimes by RID, libs by TFM#1963

Draft
jshigetomi wants to merge 1 commit intoPowerShell:masterfrom
jshigetomi:runtimePackageResolution
Draft

Platform-aware Install-PSResource: filter runtimes by RID, libs by TFM#1963
jshigetomi wants to merge 1 commit intoPowerShell:masterfrom
jshigetomi:runtimePackageResolution

Conversation

@jshigetomi
Copy link
Contributor

@jshigetomi jshigetomi commented Mar 16, 2026

PR Summary

This pull request introduces platform-aware filtering for package extraction, allowing for more precise installation of runtime and framework-specific assets. It adds new parameters to control runtime and target framework selection, and implements logic to only extract files relevant to the current or specified environment. Additionally, it exposes new internal hooks for testing and introspection of runtime and package filtering behavior.

Platform-aware extraction and filtering:

  • Added support for filtering extracted package files by Runtime Identifier (RID) and Target Framework Moniker (TFM) during installation. Only assets matching the detected or specified platform/framework are extracted from .nupkg files, improving cross-platform compatibility and reducing unnecessary files. (InstallHelper.cs, InstallPSResource.cs) [1] [2] [3] [4]

  • Introduced new parameters to the install command: SkipRuntimeFiltering, RuntimeIdentifier, and TargetFramework, allowing users to control platform and framework filtering behavior during installation. (InstallPSResource.cs)

Internal APIs and test hooks:

  • Exposed internal static methods for retrieving and testing runtime identifier compatibility and package entry filtering, facilitating unit testing and debugging of platform-specific logic. (InternalHooks.cs)

Dependency and import updates:

  • Added references to NuGet.Frameworks and related namespaces to support framework parsing and selection logic. (InstallHelper.cs, PSResourceInfo.cs) [1] [2]

These changes collectively enable more intelligent and customizable package installation, especially for scenarios involving cross-platform deployments or advanced asset filtering.

Tooling Impact

This PR adds new user-facing parameters -RuntimeIdentifier, -TargetFramework, -SkipRuntimeFiltering and changes default install behavior (fewer files extracted). That could impact:

  • Scripts that glob installed module contents — e.g., scripts expecting all runtimes/ folders to exist would now find only one
  • CI/CD pipelines doing cross-platform packaging — users who previously installed on Windows and copied to Linux may need -SkipRuntimeFiltering or explicit -RuntimeIdentifier
  • Module size expectations — installed module size drops significantly, which is the goal but could surprise tooling that checks disk usage

PR Context

Platform aware installation was brought up in issue: #794.

PR Checklist

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.

1 participant