Skip to content

Update Language-Interop-and-.NET.md #189

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MaximFworks
Copy link

This is more accurate and informative.

This is more accurate and informative.
@@ -26,7 +26,7 @@ All that said, make sure you specify the version of PowerShell you wrote for by
#requires -version 3.0
```

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).
Copy link
Member

Choose a reason for hiding this comment

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

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.1

This #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.

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