Skip to content

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

Open
jshigetomi wants to merge 7 commits intoPowerShell:masterfrom
jshigetomi:runtimePackageResolution
Open

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

Conversation

@jshigetomi
Copy link
Copy Markdown
Contributor

@jshigetomi jshigetomi commented Mar 16, 2026

PR Summary

Adds automatic RID (Runtime Identifier) and TFM (Target Framework Moniker) filtering during package extraction, plus two new parameters (-RuntimeIdentifier, -TargetFramework) for explicit cross-platform/cross-framework deployment.


Design Decisions for Review

1. Root-level RID folders, not NuGet runtimes/ convention

PowerShell modules use win-x64/, linux-x64/ at the package root for native assets, not the standard NuGet runtimes/{rid}/native/ layout. Filtering targets this PS-ecosystem convention.

2. Merge semantics on re-install with explicit overrides

  • No override specified + already installed → warn and skip (unchanged behavior)
  • Explicit -TargetFramework or -RuntimeIdentifier + already installed → merge new content into existing version directory without overwriting files
  • -Reinstall + override → full replace (clean filtered install)

This enables incremental multi-target builds:

Install-PSResource -Name MyModule                             # gets net8.0
Install-PSResource -Name MyModule -TargetFramework 'net472'   # merges net472 into same dir

3. Singular TFM selection — no fallback extraction

NuGet.Frameworks.FrameworkReducer picks the single best-match TFM from lib/. Only that TFM's assemblies are extracted — no fallback that extracts multiple TFMs. This prevents accidental cross-lineage mixing but means users must explicitly merge if they need both.

4. Cross-lineage warning

When the selected TFM is .NETCoreApp but the package also has net472 (or vice versa), a non-fatal warning tells the user how to add the other lineage:

WARNING: This package contains assemblies for net472 which were not installed
because the current runtime selected net8.0. If you also use this module on
Windows PowerShell 5.1, run: Install-PSResource -Name <ModuleName> -TargetFramework 'net472'

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