diff --git a/CHANGELOG/v7.7/dependencychanges.json b/CHANGELOG/v7.7/dependencychanges.json index ccaabfce2c1..4f1924c3a8e 100644 --- a/CHANGELOG/v7.7/dependencychanges.json +++ b/CHANGELOG/v7.7/dependencychanges.json @@ -24,5 +24,18 @@ "AdvisoryUrls": [], "Justification": "Updated .NET SDK. Building with the latest SDK is required.", "TimestampUtc": "2026-05-22T18:15:20.6826051Z" + }, + { + "ChangeType": "NonSecurity", + "Branch": "master", + "PackageId": ".NET SDK", + "FromVersion": "11.0.100-preview.4.26230.115", + "ToVersion": "11.0.100-preview.5.26302.115", + "VulnerabilityId": [], + "Severity": [], + "VulnerableRanges": [], + "AdvisoryUrls": [], + "Justification": "Updated .NET SDK. Building with the latest SDK is required.", + "TimestampUtc": "2026-06-09T19:43:07.2603946Z" } ] diff --git a/DotnetRuntimeMetadata.json b/DotnetRuntimeMetadata.json index d06d4aaeaa5..f402786a771 100644 --- a/DotnetRuntimeMetadata.json +++ b/DotnetRuntimeMetadata.json @@ -4,7 +4,7 @@ "quality": "daily", "qualityFallback": "preview", "packageVersionPattern": "9.0.0-preview.6", - "sdkImageVersion": "11.0.100-preview.4.26230.115", + "sdkImageVersion": "11.0.100-preview.5.26302.115", "nextChannel": "9.0.0-preview.7", "azureFeed": "", "sdkImageOverride": "" diff --git a/global.json b/global.json index 92499a1ba9c..e3d0a4cb71b 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "11.0.100-preview.4.26230.115" + "version": "11.0.100-preview.5.26302.115" } } diff --git a/src/Microsoft.PowerShell.Commands.Diagnostics/Microsoft.PowerShell.Commands.Diagnostics.csproj b/src/Microsoft.PowerShell.Commands.Diagnostics/Microsoft.PowerShell.Commands.Diagnostics.csproj index 47acaaf4651..94b090d4e02 100644 --- a/src/Microsoft.PowerShell.Commands.Diagnostics/Microsoft.PowerShell.Commands.Diagnostics.csproj +++ b/src/Microsoft.PowerShell.Commands.Diagnostics/Microsoft.PowerShell.Commands.Diagnostics.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/Microsoft.PowerShell.Commands.Management/Microsoft.PowerShell.Commands.Management.csproj b/src/Microsoft.PowerShell.Commands.Management/Microsoft.PowerShell.Commands.Management.csproj index 3ca7ee64edc..434322304e4 100644 --- a/src/Microsoft.PowerShell.Commands.Management/Microsoft.PowerShell.Commands.Management.csproj +++ b/src/Microsoft.PowerShell.Commands.Management/Microsoft.PowerShell.Commands.Management.csproj @@ -47,7 +47,7 @@ - + diff --git a/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj b/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj index 39436279172..6b893ccbfec 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj +++ b/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj @@ -33,7 +33,7 @@ - + diff --git a/src/Microsoft.PowerShell.CoreCLR.Eventing/Microsoft.PowerShell.CoreCLR.Eventing.csproj b/src/Microsoft.PowerShell.CoreCLR.Eventing/Microsoft.PowerShell.CoreCLR.Eventing.csproj index b10249b9351..45353f81bab 100644 --- a/src/Microsoft.PowerShell.CoreCLR.Eventing/Microsoft.PowerShell.CoreCLR.Eventing.csproj +++ b/src/Microsoft.PowerShell.CoreCLR.Eventing/Microsoft.PowerShell.CoreCLR.Eventing.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj b/src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj index 90141f51a6b..b6d9be2e2b9 100644 --- a/src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj +++ b/src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj @@ -16,19 +16,19 @@ - - + + - - + + - + - + diff --git a/src/System.Management.Automation/System.Management.Automation.csproj b/src/System.Management.Automation/System.Management.Automation.csproj index d7e96f5bd7f..753e58cd546 100644 --- a/src/System.Management.Automation/System.Management.Automation.csproj +++ b/src/System.Management.Automation/System.Management.Automation.csproj @@ -32,12 +32,12 @@ - - - - - - + + + + + + diff --git a/test/powershell/Host/ConsoleHost.Tests.ps1 b/test/powershell/Host/ConsoleHost.Tests.ps1 index 534cce2d356..735c0a39682 100644 --- a/test/powershell/Host/ConsoleHost.Tests.ps1 +++ b/test/powershell/Host/ConsoleHost.Tests.ps1 @@ -860,6 +860,8 @@ $powershell -c '[System.Management.Automation.Platform]::SelectProductNameForDir Context "ApartmentState WPF tests" -Tag Slow { It "WPF requires STA and will work" -Skip:(!$IsWindows -or [System.Management.Automation.Platform]::IsNanoServer) { + Set-ItResult -Pending -Because "Disabled due to issue - https://github.com/dotnet/wpf/issues/11651 in .NET 11 Preview 5" + Add-Type -AssemblyName presentationframework $xaml = [xml]@" diff --git a/test/tools/WebListener/WebListener.csproj b/test/tools/WebListener/WebListener.csproj index 50c28eb9acd..c3f32a83746 100644 --- a/test/tools/WebListener/WebListener.csproj +++ b/test/tools/WebListener/WebListener.csproj @@ -7,6 +7,6 @@ - + diff --git a/test/xUnit/xUnit.tests.csproj b/test/xUnit/xUnit.tests.csproj index b01f3434e69..82b13564dfc 100644 --- a/test/xUnit/xUnit.tests.csproj +++ b/test/xUnit/xUnit.tests.csproj @@ -30,7 +30,7 @@ all - + diff --git a/tools/cgmanifest/main/cgmanifest.json b/tools/cgmanifest/main/cgmanifest.json index 97e323ed123..59ef74c4220 100644 --- a/tools/cgmanifest/main/cgmanifest.json +++ b/tools/cgmanifest/main/cgmanifest.json @@ -1,4 +1,5 @@ { + "$schema": "https://json.schemastore.org/component-detection-manifest.json", "Registrations": [ { "Component": { @@ -85,7 +86,7 @@ "Type": "nuget", "Nuget": { "Name": "Microsoft.Bcl.AsyncInterfaces", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -125,7 +126,7 @@ "Type": "nuget", "Nuget": { "Name": "Microsoft.Extensions.ObjectPool", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -165,7 +166,7 @@ "Type": "nuget", "Nuget": { "Name": "Microsoft.Win32.Registry.AccessControl", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -175,7 +176,7 @@ "Type": "nuget", "Nuget": { "Name": "Microsoft.Win32.SystemEvents", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -185,7 +186,7 @@ "Type": "nuget", "Nuget": { "Name": "Microsoft.Windows.Compatibility", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -205,7 +206,7 @@ "Type": "nuget", "Nuget": { "Name": "runtime.android-arm.runtime.native.System.IO.Ports", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -215,7 +216,7 @@ "Type": "nuget", "Nuget": { "Name": "runtime.android-arm64.runtime.native.System.IO.Ports", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -225,7 +226,7 @@ "Type": "nuget", "Nuget": { "Name": "runtime.android-x64.runtime.native.System.IO.Ports", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -235,7 +236,7 @@ "Type": "nuget", "Nuget": { "Name": "runtime.android-x86.runtime.native.System.IO.Ports", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -245,7 +246,7 @@ "Type": "nuget", "Nuget": { "Name": "runtime.linux-arm.runtime.native.System.IO.Ports", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -255,7 +256,7 @@ "Type": "nuget", "Nuget": { "Name": "runtime.linux-arm64.runtime.native.System.IO.Ports", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -265,7 +266,7 @@ "Type": "nuget", "Nuget": { "Name": "runtime.linux-bionic-arm64.runtime.native.System.IO.Ports", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -275,7 +276,7 @@ "Type": "nuget", "Nuget": { "Name": "runtime.linux-bionic-x64.runtime.native.System.IO.Ports", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -285,7 +286,7 @@ "Type": "nuget", "Nuget": { "Name": "runtime.linux-musl-arm.runtime.native.System.IO.Ports", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -295,7 +296,7 @@ "Type": "nuget", "Nuget": { "Name": "runtime.linux-musl-arm64.runtime.native.System.IO.Ports", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -305,7 +306,7 @@ "Type": "nuget", "Nuget": { "Name": "runtime.linux-musl-x64.runtime.native.System.IO.Ports", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -315,7 +316,7 @@ "Type": "nuget", "Nuget": { "Name": "runtime.linux-x64.runtime.native.System.IO.Ports", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -325,7 +326,7 @@ "Type": "nuget", "Nuget": { "Name": "runtime.maccatalyst-arm64.runtime.native.System.IO.Ports", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -335,7 +336,7 @@ "Type": "nuget", "Nuget": { "Name": "runtime.maccatalyst-x64.runtime.native.System.IO.Ports", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -355,7 +356,7 @@ "Type": "nuget", "Nuget": { "Name": "runtime.native.System.IO.Ports", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -365,7 +366,7 @@ "Type": "nuget", "Nuget": { "Name": "runtime.osx-arm64.runtime.native.System.IO.Ports", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -375,7 +376,7 @@ "Type": "nuget", "Nuget": { "Name": "runtime.osx-x64.runtime.native.System.IO.Ports", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -435,7 +436,7 @@ "Type": "nuget", "Nuget": { "Name": "System.CodeDom", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -445,7 +446,7 @@ "Type": "nuget", "Nuget": { "Name": "System.ComponentModel.Composition.Registration", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -455,7 +456,7 @@ "Type": "nuget", "Nuget": { "Name": "System.ComponentModel.Composition", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -465,7 +466,7 @@ "Type": "nuget", "Nuget": { "Name": "System.Configuration.ConfigurationManager", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -475,7 +476,7 @@ "Type": "nuget", "Nuget": { "Name": "System.Data.Odbc", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -485,7 +486,7 @@ "Type": "nuget", "Nuget": { "Name": "System.Data.OleDb", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -505,7 +506,7 @@ "Type": "nuget", "Nuget": { "Name": "System.Diagnostics.EventLog", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -515,7 +516,7 @@ "Type": "nuget", "Nuget": { "Name": "System.Diagnostics.PerformanceCounter", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -525,7 +526,7 @@ "Type": "nuget", "Nuget": { "Name": "System.DirectoryServices.AccountManagement", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -535,7 +536,7 @@ "Type": "nuget", "Nuget": { "Name": "System.DirectoryServices.Protocols", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -545,7 +546,7 @@ "Type": "nuget", "Nuget": { "Name": "System.DirectoryServices", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -555,7 +556,7 @@ "Type": "nuget", "Nuget": { "Name": "System.Drawing.Common", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -565,7 +566,7 @@ "Type": "nuget", "Nuget": { "Name": "System.IO.Packaging", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -575,7 +576,7 @@ "Type": "nuget", "Nuget": { "Name": "System.IO.Ports", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -585,7 +586,7 @@ "Type": "nuget", "Nuget": { "Name": "System.Management", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -595,7 +596,7 @@ "Type": "nuget", "Nuget": { "Name": "System.Net.Http.WinHttpHandler", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -605,7 +606,7 @@ "Type": "nuget", "Nuget": { "Name": "System.Reflection.Context", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -615,7 +616,7 @@ "Type": "nuget", "Nuget": { "Name": "System.Runtime.Caching", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -625,7 +626,7 @@ "Type": "nuget", "Nuget": { "Name": "System.Security.Cryptography.Pkcs", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -635,7 +636,7 @@ "Type": "nuget", "Nuget": { "Name": "System.Security.Cryptography.ProtectedData", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -645,7 +646,7 @@ "Type": "nuget", "Nuget": { "Name": "System.Security.Cryptography.Xml", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -655,7 +656,7 @@ "Type": "nuget", "Nuget": { "Name": "System.Security.Permissions", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -705,7 +706,7 @@ "Type": "nuget", "Nuget": { "Name": "System.ServiceModel.Syndication", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -715,7 +716,7 @@ "Type": "nuget", "Nuget": { "Name": "System.ServiceProcess.ServiceController", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -725,7 +726,7 @@ "Type": "nuget", "Nuget": { "Name": "System.Speech", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false @@ -745,11 +746,10 @@ "Type": "nuget", "Nuget": { "Name": "System.Windows.Extensions", - "Version": "10.0.8" + "Version": "10.0.9" } }, "DevelopmentDependency": false } - ], - "$schema": "https://json.schemastore.org/component-detection-manifest.json" + ] } diff --git a/tools/install-powershell.ps1 b/tools/install-powershell.ps1 index 414f0b35bb3..4a5c2f1f615 100644 --- a/tools/install-powershell.ps1 +++ b/tools/install-powershell.ps1 @@ -5,12 +5,11 @@ Install PowerShell on Windows, Linux or macOS. .DESCRIPTION By default, the latest PowerShell release package will be installed. - If '-Daily' is specified, then the latest PowerShell daily package will be installed. + If '-Preview' is specified, then the latest PowerShell preview package will be installed. .Parameter Destination The destination path to install PowerShell to. -.Parameter Daily - Install PowerShell from the daily build. - Note that the 'PackageManagement' module is required to install a daily package. +.Parameter Preview + Install the latest PowerShell preview build. .Parameter DoNotOverwrite Do not overwrite the destination folder if it already exists. .Parameter AddToPath @@ -18,24 +17,27 @@ On Linux, make the symlink '/usr/bin/pwsh' points to "$Destination/pwsh"; On MacOS, make the symlink '/usr/local/bin/pwsh' points to "$Destination/pwsh". .EXAMPLE - Install the daily build - .\install-powershell.ps1 -Daily + Install the preview build + .\install-powershell.ps1 -Preview .EXAMPLE Invoke this script directly from GitHub - Invoke-Expression "& { $(Invoke-RestMethod 'https://aka.ms/install-powershell.ps1') } -daily" + Invoke-Expression "& { $(Invoke-RestMethod 'https://aka.ms/install-powershell.ps1') } -Preview" #> -[CmdletBinding(DefaultParameterSetName = "Daily")] +[CmdletBinding()] param( - [Parameter(ParameterSetName = "Daily")] - [string] $Destination, + [Parameter()] + [switch] $Preview, + + [Parameter()] + [switch] $Daily, # Exists for backward compatibility - [Parameter(ParameterSetName = "Daily")] - [switch] $Daily, + [Parameter()] + [string] $Destination, - [Parameter(ParameterSetName = "Daily")] + [Parameter()] [switch] $DoNotOverwrite, - [Parameter(ParameterSetName = "Daily")] + [Parameter()] [switch] $AddToPath, [Parameter(ParameterSetName = "MSI")] @@ -48,10 +50,7 @@ param( [switch] $AddExplorerContextMenu, [Parameter(ParameterSetName = "MSI")] - [switch] $EnablePSRemoting, - - [Parameter()] - [switch] $Preview + [switch] $EnablePSRemoting ) Set-StrictMode -Version 3.0 @@ -61,6 +60,11 @@ $IsLinuxEnv = (Get-Variable -Name "IsLinux" -ErrorAction Ignore) -and $IsLinux $IsMacOSEnv = (Get-Variable -Name "IsMacOS" -ErrorAction Ignore) -and $IsMacOS $IsWinEnv = !$IsLinuxEnv -and !$IsMacOSEnv +if ($Daily) { + $Preview = $true + Write-Warning "The '-Daily' build is deprecated. Continuing as if '-Preview' was specified instead." +} + if (-not $Destination) { if ($IsWinEnv) { $Destination = "$env:LOCALAPPDATA\Microsoft\powershell" @@ -68,8 +72,8 @@ if (-not $Destination) { $Destination = "~/.powershell" } - if ($Daily) { - $Destination = "${Destination}-daily" + if ($Preview) { + $Destination = "${Destination}-preview" } } @@ -265,145 +269,68 @@ try { $originalValue = [Net.ServicePointManager]::SecurityProtocol [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 - if ($Daily) { - $metadata = Invoke-RestMethod 'https://aka.ms/pwsh-buildinfo-daily' + $metadata = Invoke-RestMethod 'https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/metadata.json' + if ($Preview) { + $release = $metadata.PreviewReleaseTag -replace '^v' + } else { $release = $metadata.ReleaseTag -replace '^v' + } - # Get version from currently installed PowerShell Daily if available. - $pwshPath = if ($IsWinEnv) {Join-Path $Destination "pwsh.exe"} else {Join-Path $Destination "pwsh"} - $currentlyInstalledVersion = if(Test-Path $pwshPath) { - ((& $pwshPath -version) -split " ")[1] - } - - if($currentlyInstalledVersion -eq $release) { - Write-Verbose "Latest PowerShell Daily already installed." -Verbose - return - } - - if ($IsWinEnv) { - if ($UseMSI) { - $packageName = "PowerShell-${release}-win-${architecture}.msi" - } else { - $packageName = "PowerShell-${release}-win-${architecture}.zip" - } - } elseif ($IsLinuxEnv) { - $packageName = "powershell-${release}-linux-${architecture}.tar.gz" - } elseif ($IsMacOSEnv) { - $packageName = "powershell-${release}-osx-${architecture}.tar.gz" + if ($IsWinEnv) { + if ($UseMSI) { + $packageName = "PowerShell-${release}-win-${architecture}.msi" + } else { + $packageName = "PowerShell-${release}-win-${architecture}.zip" } + } elseif ($IsLinuxEnv) { + $packageName = "powershell-${release}-linux-${architecture}.tar.gz" + } elseif ($IsMacOSEnv) { + $packageName = "powershell-${release}-osx-${architecture}.tar.gz" + } - if ($architecture -ne "x64") { - throw "The OS architecture is '$architecture'. However, we currently only support daily package for x64." - } + $downloadURL = "https://github.com/PowerShell/PowerShell/releases/download/v${release}/${packageName}" + Write-Verbose "About to download package from '$downloadURL'" -Verbose - $downloadURL = "https://powershellinfraartifacts-gkhedzdeaghdezhr.z01.azurefd.net/install/$($metadata.ReleaseTag)/$packageName" - Write-Verbose "About to download package from '$downloadURL'" -Verbose + $packagePath = Join-Path -Path $tempDir -ChildPath $packageName + if (!$PSVersionTable.ContainsKey('PSEdition') -or $PSVersionTable.PSEdition -eq "Desktop") { + # On Windows PowerShell, progress can make the download significantly slower + $oldProgressPreference = $ProgressPreference + $ProgressPreference = "SilentlyContinue" + } - $packagePath = Join-Path -Path $tempDir -ChildPath $packageName + try { + Invoke-WebRequest -Uri $downloadURL -OutFile $packagePath + } finally { if (!$PSVersionTable.ContainsKey('PSEdition') -or $PSVersionTable.PSEdition -eq "Desktop") { - # On Windows PowerShell, progress can make the download significantly slower - $oldProgressPreference = $ProgressPreference - $ProgressPreference = "SilentlyContinue" + $ProgressPreference = $oldProgressPreference } + } - try { - Invoke-WebRequest -Uri $downloadURL -OutFile $packagePath - } finally { - if (!$PSVersionTable.ContainsKey('PSEdition') -or $PSVersionTable.PSEdition -eq "Desktop") { - $ProgressPreference = $oldProgressPreference - } - } - - $contentPath = Join-Path -Path $tempDir -ChildPath "new" - - $null = New-Item -ItemType Directory -Path $contentPath -ErrorAction SilentlyContinue - if ($IsWinEnv) { - if ($UseMSI -and $Quiet) { - Write-Verbose "Performing quiet install" - $ArgumentList=@("/i", $packagePath, "/quiet") - if($MSIArguments) { - $ArgumentList+=$MSIArguments - } - $process = Start-Process msiexec -ArgumentList $ArgumentList -Wait -PassThru - if ($process.exitcode -ne 0) { - throw "Quiet install failed, please rerun install without -Quiet switch or ensure you have administrator rights" - } - } elseif ($UseMSI) { - if($MSIArguments) { - Start-Process $packagePath -ArgumentList $MSIArguments -Wait - } else { - Start-Process $packagePath -Wait - } - } else { - Expand-ArchiveInternal -Path $packagePath -DestinationPath $contentPath - } - } else { - tar zxf $packagePath -C $contentPath - } - } else { - $metadata = Invoke-RestMethod https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/metadata.json - if ($Preview) { - $release = $metadata.PreviewReleaseTag -replace '^v' - } else { - $release = $metadata.ReleaseTag -replace '^v' - } + $contentPath = Join-Path -Path $tempDir -ChildPath "new" - if ($IsWinEnv) { - if ($UseMSI) { - $packageName = "PowerShell-${release}-win-${architecture}.msi" - } else { - $packageName = "PowerShell-${release}-win-${architecture}.zip" + $null = New-Item -ItemType Directory -Path $contentPath -ErrorAction SilentlyContinue + if ($IsWinEnv) { + if ($UseMSI -and $Quiet) { + Write-Verbose "Performing quiet install" + $ArgumentList=@("/i", $packagePath, "/quiet") + if($MSIArguments) { + $ArgumentList+=$MSIArguments } - } elseif ($IsLinuxEnv) { - $packageName = "powershell-${release}-linux-${architecture}.tar.gz" - } elseif ($IsMacOSEnv) { - $packageName = "powershell-${release}-osx-${architecture}.tar.gz" - } - - $downloadURL = "https://github.com/PowerShell/PowerShell/releases/download/v${release}/${packageName}" - Write-Verbose "About to download package from '$downloadURL'" -Verbose - - $packagePath = Join-Path -Path $tempDir -ChildPath $packageName - if (!$PSVersionTable.ContainsKey('PSEdition') -or $PSVersionTable.PSEdition -eq "Desktop") { - # On Windows PowerShell, progress can make the download significantly slower - $oldProgressPreference = $ProgressPreference - $ProgressPreference = "SilentlyContinue" - } - - try { - Invoke-WebRequest -Uri $downloadURL -OutFile $packagePath - } finally { - if (!$PSVersionTable.ContainsKey('PSEdition') -or $PSVersionTable.PSEdition -eq "Desktop") { - $ProgressPreference = $oldProgressPreference + $process = Start-Process msiexec -ArgumentList $ArgumentList -Wait -PassThru + if ($process.exitcode -ne 0) { + throw "Quiet install failed, please rerun install without -Quiet switch or ensure you have administrator rights" } - } - - $contentPath = Join-Path -Path $tempDir -ChildPath "new" - - $null = New-Item -ItemType Directory -Path $contentPath -ErrorAction SilentlyContinue - if ($IsWinEnv) { - if ($UseMSI -and $Quiet) { - Write-Verbose "Performing quiet install" - $ArgumentList=@("/i", $packagePath, "/quiet") - if($MSIArguments) { - $ArgumentList+=$MSIArguments - } - $process = Start-Process msiexec -ArgumentList $ArgumentList -Wait -PassThru - if ($process.exitcode -ne 0) { - throw "Quiet install failed, please rerun install without -Quiet switch or ensure you have administrator rights" - } - } elseif ($UseMSI) { - if($MSIArguments) { - Start-Process $packagePath -ArgumentList $MSIArguments -Wait - } else { - Start-Process $packagePath -Wait - } + } elseif ($UseMSI) { + if($MSIArguments) { + Start-Process $packagePath -ArgumentList $MSIArguments -Wait } else { - Expand-ArchiveInternal -Path $packagePath -DestinationPath $contentPath + Start-Process $packagePath -Wait } } else { - tar zxf $packagePath -C $contentPath + Expand-ArchiveInternal -Path $packagePath -DestinationPath $contentPath } + } else { + tar zxf $packagePath -C $contentPath } if (-not $UseMSI) { diff --git a/tools/install-powershell.ps1-README.md b/tools/install-powershell.ps1-README.md index e6b31a60c4e..18c7f714937 100644 --- a/tools/install-powershell.ps1-README.md +++ b/tools/install-powershell.ps1-README.md @@ -2,23 +2,22 @@ ## Features of install-powershell.ps1 -* Can be called directly from git -* Optionally allows install of the latest Preview build -* Optionally allows install of the Daily build -* Optionally installs using the latest MSI -* Automatically looks up latest version via git tags -* Optionally installs silently -* Optionally adds the install location to Path environment variable +- Can be called directly from Git +- Optionally allows install of the latest Preview build +- Optionally installs using the latest MSI +- Automatically looks up latest version via Git tags +- Optionally installs silently +- Optionally adds the install location to Path environment variable ## Examples -### Install PowerShell Core Daily Build +### Install PowerShell Preview Build ```PowerShell -Invoke-Expression "& { $(Invoke-RestMethod 'https://aka.ms/install-powershell.ps1') } -daily" +Invoke-Expression "& { $(Invoke-RestMethod 'https://aka.ms/install-powershell.ps1') } -Preview" ``` -### Install PowerShell Core using the MSI installer +### Install PowerShell using the MSI installer ```PowerShell Invoke-Expression "& { $(Invoke-RestMethod 'https://aka.ms/install-powershell.ps1') } -UseMSI"