Skip to content

PowerShell v6.0.0_Alpha.13 ignoring the "#requires -version" statement #2846

Closed
@MaximoTrinidad

Description

@MaximoTrinidad

Steps to reproduce

Create a script file and include the " #requires -version 5" line before the code.
Open PowerShell v6.0.0_Alpha-13
run .scriptfile.ps1

Expected behavior

Script file will error-out with the message:
"... cannot be run because it contained a "#requires" statement for Windows PowerShell 5.0..."

Actual behavior

It continues to execute the script file.

Environment data

OS: Windows 10 Pro Insider Preview 14971

PS C:\Program Files\PowerShell\6.0.0.13> $PSVersionTable

Name                           Value
----                           -----
CLRVersion
PSVersion                      6.0.0-alpha
SerializationVersion           1.1.0.1
BuildVersion                   3.0.0.0
GitCommitId                    v6.0.0-alpha.13
WSManStackVersion              3.0
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSEdition                      Core
PSRemotingProtocolVersion      2.3

psreqversionissue

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifResolution-AnsweredThe question is answered.WG-Enginecore PowerShell engine, interpreter, and runtime

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions