Uh oh!
There was an error while loading. Please reload this page.
Update Language-Interop-and-.NET.md - #189
Conversation
This is more accurate and informative.
| ``` | ||
| 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). |
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 -version5.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 is more accurate and informative.