Start-PSBootstrap fails on PowerShell 5.1
See original GitHub issuePrerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
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
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Bug in PowerShell version 5.1.17134.165 $Using: fails ...
The following script fails when used interactively (F8 in ISE or pasted in the console) on Windows 10 1803; $FilePath = "C:\Temp\JobTest2.txt"
Read more >Updating help for the PSReadLine module in Windows ...
Update-Help still fails in Windows PowerShell 5.1 · Open an elevated powershell.exe session (Run as Administrator). · Run Remove-Module PSReadLine ...
Read more >Known Issues in WMF 5.1 - PowerShell
Upon installing WMF, if you try to start PowerShell as administrator from the shortcut, you may get an "Unspecified error" message.
Read more >Error -MIM :incorrect windows powershell version 5.1 ...
I am trying to run powershell script inside workflow in MIM 2016 , but getting below error . "incorrect windows powershell version 5.1...
Read more >Powershell broke - basic commands not working ...
I was using VS Code on Windows 10 and using PowerShell 5.1. Checked all the environmental variables, everything looks fine.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It was too unexpected to find that the module did not work. I personally do not ready to switch completely to pwsh in my work (there are still many places where powershell has no alternative to pwsh).
@PowerShell/powershell-maintainers have a consensus that PowerShell 7 is stable enough to be used for development of PowerShell. It would require a lot of effort to ensure Windows PowerShell 5.1 compatibility, which we think is unnecessary. We propose to add
#requires -version 7
to build.psm1.