Skip to content

Start-PSBootstrap fails on PowerShell 5.1 #16330

@kborowinski

Description

@kborowinski

Prerequisites

Steps to reproduce

Start-PSBootstrap fails on PowerShell 5.1 due to use of unsupported type [System.Management.Automation.SemanticVersion] in build.psm1 therefore it is not possible to build latest versions of PowerShell 7 on PowerShell 5.1 anymore.

Expected behavior

*Start-PSBootstrap* should work on PowerShell 5.1

Actual behavior

*Start-PSBootstrap* throws error on PowerShell 5.1

Error details

Import-Module .\build.psm1
Start-PSBootstrap
Installing PowerShell build dependencies
VERBOSE: Calling Find-Dotnet from Start-PSBootstrap
VERBOSE: In Find-DotNet
ForEach-Object : Unable to find type [System.Management.Automation.SemanticVersion].
At D:\DEVELOPMENT\PowerShellCore\build.psm1:2106 char:81
+ ... *\.\d*)?' | ForEach-Object { [System.Management.Automation.SemanticVe ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Manageme...SemanticVersion:TypeName) [ForEach-Object], RuntimeException
    + FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.ForEachObjectCommand

$error[0]|fl * -force


PSMessageDetails      :
Exception             : System.Management.Automation.RuntimeException: Unable to find type [System.Management.Automation.SemanticVersion].
                           at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
                           at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
                           at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
                           at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
                           at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
                           at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
                           at System.Management.Automation.ScriptBlock.InvokeWithPipeImpl(ScriptBlockClauseToInvoke clauseToInvoke, Boolean createLocalScope, Dictionary`2 functionsToDefine, List`1
                        variablesToDefine, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Object[] args)
                           at System.Management.Automation.ScriptBlock.<>c__DisplayClass57_0.<InvokeWithPipe>b__0()
                           at System.Management.Automation.Runspaces.RunspaceBase.RunActionIfNoRunningPipelinesWithThreadCheck(Action action)
                           at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis,
                        Pipe outputPipe, InvocationInfo invocationInfo, Boolean propagateAllExceptionsToTop, List`1 variablesToDefine, Dictionary`2 functionsToDefine, Object[] args)
                           at System.Management.Automation.ScriptBlock.InvokeUsingCmdlet(Cmdlet contextCmdlet, Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object
                        input, Object scriptThis, Object[] args)
                           at Microsoft.PowerShell.Commands.ForEachObjectCommand.ProcessRecord()
                           at System.Management.Automation.CommandProcessor.ProcessRecord()
TargetObject          : System.Management.Automation.SemanticVersion
CategoryInfo          : InvalidOperation: (System.Manageme...SemanticVersion:TypeName) [], RuntimeException
FullyQualifiedErrorId : TypeNotFound
ErrorDetails          :
InvocationInfo        : System.Management.Automation.InvocationInfo
ScriptStackTrace      : at <ScriptBlock>, D:\DEVELOPMENT\PowerShellCore\build.psm1: line 2106
                        at <ScriptBlock>, D:\DEVELOPMENT\PowerShellCore\build.psm1: line 2106
                        at script:Start-NativeExecution, D:\DEVELOPMENT\PowerShellCore\tools\buildCommon\startNativeExecution.ps1: line 22
                        at Get-LatestInstalledSDK, D:\DEVELOPMENT\PowerShellCore\build.psm1: line 2105
                        at Find-Dotnet, D:\DEVELOPMENT\PowerShellCore\build.psm1: line 2259
                        at Start-PSBootstrap, D:\DEVELOPMENT\PowerShellCore\build.psm1: line 2054
                        at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {}

Environment data

Name                           Value
----                           -----
PSVersion                      5.1.19041.1237
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.1237
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Visuals

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-Maintainers-Buildspecific to affecting the buildResolution-Won't FixThe issue won't be fixed, possibly due to compatibility reason.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions