Skip to content

Conversation

@jshigetomi
Copy link

@jshigetomi jshigetomi commented Jan 7, 2026

PR Summary

This pull request upgrades the PSReadLine project to target .NET 8 and PowerShell 7.4+, removing legacy and polyfill code for older frameworks. It updates all project files, build scripts, and dependencies to use the latest versions, and enforces compatibility at both the module and script level. The most important changes are summarized below.

Framework and Dependency Upgrades:

  • All projects (PSReadLine, MockPSConsole, and tests) now target .NET 8.0 exclusively, removing support for older frameworks such as netstandard2.0, net472, and net6.0. Corresponding dependencies are updated to the latest compatible versions, including Microsoft.PowerShell.SDK 7.4.0. ([[1]](https://github.com/PowerShell/PSReadLine/pull/5055/files#diff-15b49bb2c4d47eeb9db538533ac5b972f85f34ba280b7acb42c1b5c27db438e9L8-R21), [[2]](https://github.com/PowerShell/PSReadLine/pull/5055/files#diff-3fcef917fe90ddf5a3b2ef1d86c3505ec20ab64f86c0febed8d682b19f8a84a3L7-R14), [[3]](https://github.com/PowerShell/PSReadLine/pull/5055/files#diff-08cd1f3a887d8dcf95b9437203d198df174e72fa3bed3645db09901adb95ac2fL8-R8), [[4]](https://github.com/PowerShell/PSReadLine/pull/5055/files#diff-08cd1f3a887d8dcf95b9437203d198df174e72fa3bed3645db09901adb95ac2fL17-R18))
  • The build process and global.json are updated to require .NET SDK 8.0.416. ([[1]](https://github.com/PowerShell/PSReadLine/pull/5055/files#diff-8df3cd354bc584349d04ad5675b33c042d8b99b741b8b95af394c55e0f5001bfR1-R7), [[2]](https://github.com/PowerShell/PSReadLine/pull/5055/files#diff-cf52a72665faf1250da83a9745360bf052fadf8f4a395bf0557d6f1b6ffcec18L22-L63))

PowerShell Version Requirement:

  • The module manifest (PSReadLine.psd1) and the main module script (PSReadLine.psm1) now require PowerShell 7.4 or later. The script throws a clear error if loaded in an older version, with instructions for users. ([[1]](https://github.com/PowerShell/PSReadLine/pull/5055/files#diff-249c945874c86bf263442fb1b4ffbc108e8642a3ce9b0d05a6e1b103a7933bbeL4-R10), [[2]](https://github.com/PowerShell/PSReadLine/pull/5055/files#diff-7a6a99977c8583b1131f983549f09dac821eb025205e76fa1d4ce533438bcb4aR1-R14))

Removal of Legacy and Polyfill Code:

  • The Polyfill project and related code (including CommandPrediction.cs and Polyfill.csproj) are deleted, simplifying the codebase and eliminating support for legacy PowerShell versions. Build scripts are updated to remove all polyfill-related tasks. ([[1]](https://github.com/PowerShell/PSReadLine/pull/5055/files#diff-ed6d8ebde2b95773782d7bbedbc734f0a7f97b1d70355fee2e6b9f130329481fL1-L232), [[2]](https://github.com/PowerShell/PSReadLine/pull/5055/files#diff-9bbfd47219535f7987f69c047ce2324aba293c39340a1edb0be346d75cde5f0aL1-L22), [[3]](https://github.com/PowerShell/PSReadLine/pull/5055/files#diff-cf52a72665faf1250da83a9745360bf052fadf8f4a395bf0557d6f1b6ffcec18L22-L63), [[4]](https://github.com/PowerShell/PSReadLine/pull/5055/files#diff-cf52a72665faf1250da83a9745360bf052fadf8f4a395bf0557d6f1b6ffcec18L100-R92), [[5]](https://github.com/PowerShell/PSReadLine/pull/5055/files#diff-cf52a72665faf1250da83a9745360bf052fadf8f4a395bf0557d6f1b6ffcec18L118-R110))

Version Bump:

  • The PSReadLine module version is updated to 3.0.0 across all relevant files, reflecting the breaking changes and new requirements. ([[1]](https://github.com/PowerShell/PSReadLine/pull/5055/files#diff-15b49bb2c4d47eeb9db538533ac5b972f85f34ba280b7acb42c1b5c27db438e9L8-R21), [[2]](https://github.com/PowerShell/PSReadLine/pull/5055/files#diff-249c945874c86bf263442fb1b4ffbc108e8642a3ce9b0d05a6e1b103a7933bbeL4-R10))

Development Environment Updates:

  • The VS Code launch configuration is updated to reference the new build output path for .NET 8.0. ([.vscode/launch.jsonL17-R17](https://github.com/PowerShell/PSReadLine/pull/5055/files#diff-bd5430ee7c51dc892a67b3f2829d1f5b6d223f0fd48b82322cfd45baf9f5e945L17-R17))

These changes modernize PSReadLine, streamline its development and deployment, and ensure compatibility with the latest PowerShell and .NET releases.

PR Checklist

  • PR has a meaningful title
    • Use the present tense and imperative mood when describing your changes
  • Summarized changes
  • Make sure you've added one or more new tests
  • Make sure you've tested these changes in terminals that PowerShell is commonly used in (i.e. conhost.exe, Windows Terminal, Visual Studio Code Integrated Terminal, etc.)
  • User-facing changes
    • Not Applicable
    • OR
    • Documentation needed at PowerShell-Docs
      • Doc Issue filed:
Microsoft Reviewers: Open in CodeFlow

To upgrade PowerShell: https://aka.ms/install-powershell
"@
throw $errorMessage
}
Copy link
Member

Choose a reason for hiding this comment

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

PowerShellVersion = '7.4' in the psd1 file will prevent the module from being loaded, so if PSReadLine.psm1 will never get executed for a PS session older than 7.4. So, this change is not needed.

Copy link
Author

Choose a reason for hiding this comment

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

In that case where can we write the user friendly error message?
I think the error message will show up like this if we rely on psd1 file

Import-Module: The specified module 'PSReadLine' was not loaded because no valid module file was found in any module directory.

Copy link
Member

Choose a reason for hiding this comment

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

No, I think the error message will call out that the PSReadLine requires PowerShell 7.4 and thus cannot be loaded.

In the long run, I don't think we can always tell the user which PSReadLine version is for which PS version, they need to find out in document, something similar to the PowerShell Support Lifecycle.

New-Item "$targetDir/netstd" -ItemType Directory -Force > $null
}
if (-not (Test-Path "$targetDir/net6plus")) {
New-Item "$targetDir/net6plus" -ItemType Directory -Force > $null
Copy link
Member

Choose a reason for hiding this comment

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

There is code to handle loading of the polyfill assembly when the module gets loaded. That needs to be changed too.

Copy link
Author

Choose a reason for hiding this comment

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

I removed a module interface file. Are there more?

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.

2 participants