Update Language-Interop-and-.NET.md#189
Open
MaximFworks wants to merge 1 commit intoPoshCode:masterfrom
Open
Conversation
This is more accurate and informative.
Jaykul
reviewed
Mar 22, 2025
| ``` | ||
|
|
||
| The `#requires` statement will prevent the script from running on the wrong version of PowerShell. | ||
| The `#requires` statement will make sure, that version of PowerShell is at least 3.0, or the script will exit with the error "ScriptRequiresUnmatchedPSVersion". You may still encounter problems if you run PowerShell 5.1 (.NET Framework) scripts on PowerShell 7+ (.NET Core). |
Member
There was a problem hiding this comment.
I think this whole section probably needs to be rewritten in the modern era, because we should have more information here about "Windows PowerShell" (PowerShell) vs. "PowerShell" (pwsh) and should update all the examples to drop references to 3 and 4 which are basically irrelevant today.
I don't think we want to specify what the error text is though (it does not matter, may be localized, and could change). How about we just make this say:
#requires -version 5.1This #requires statement will prevent the script from being run on a version of PowerShell older than the one specified. It does not prevent running it on newer versions, nor does it provide any compatibility mode in future versions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is more accurate and informative.