-
Notifications
You must be signed in to change notification settings - Fork 320
Target pwsh LTS .NET #5055
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Target pwsh LTS .NET #5055
Conversation
PSReadLine/PSReadLine.psm1
Outdated
| To upgrade PowerShell: https://aka.ms/install-powershell | ||
| "@ | ||
| throw $errorMessage | ||
| } |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
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:
PSReadLine,MockPSConsole, and tests) now target.NET 8.0exclusively, removing support for older frameworks such asnetstandard2.0,net472, andnet6.0. Corresponding dependencies are updated to the latest compatible versions, includingMicrosoft.PowerShell.SDK7.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))global.jsonare 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:
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:
Polyfillproject and related code (includingCommandPrediction.csandPolyfill.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:
[[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:
[.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
Microsoft Reviewers: Open in CodeFlow