|
|
@@ -15,7 +15,6 @@
|
|
|
Preview/Insiders
|
|
|
.PARAMETER Version
|
|
|
Selects which version of Visual Studio to install. Must be one of these values:
|
|
|
- 2022
|
|
|
2026
|
|
|
.PARAMETER InstallPath
|
|
|
The location on disk where Visual Studio should be installed or updated. Default path is location of latest
|
|
|
@@ -29,7 +28,7 @@
|
|
|
https://visualstudio.com
|
|
|
https://github.com/dotnet/aspnetcore/blob/main/docs/BuildFromSource.md
|
|
|
.EXAMPLE
|
|
|
- To install VS 2022 Community, run this command in PowerShell:
|
|
|
+ To install VS 2026 Community, run this command in PowerShell:
|
|
|
|
|
|
.\InstallVisualStudio.ps1
|
|
|
#>
|
|
|
@@ -38,8 +37,8 @@ param(
|
|
|
[string]$Edition = 'Community',
|
|
|
[ValidateSet('Release', 'Stable', 'Preview', 'Insiders', 'IntPreview', 'Dogfood')]
|
|
|
[string]$Channel = 'Release',
|
|
|
- [ValidateSet('2022', '2026')]
|
|
|
- [string]$Version = '2022',
|
|
|
+ [ValidateSet('2026')]
|
|
|
+ [string]$Version = '2026',
|
|
|
[string]$InstallPath,
|
|
|
[switch]$Passive,
|
|
|
[switch]$Quiet
|
|
|
@@ -65,12 +64,7 @@ mkdir $intermedateDir -ErrorAction Ignore | Out-Null
|
|
|
$bootstrapper = "$intermedateDir\vsinstaller.exe"
|
|
|
$ProgressPreference = 'SilentlyContinue' # Workaround PowerShell/PowerShell#2138
|
|
|
|
|
|
-if ("$Version" -eq "2022") {
|
|
|
- $vsversion = 17;
|
|
|
-}
|
|
|
-elseif ("$Version" -eq "2026") {
|
|
|
- $vsversion = 18;
|
|
|
-}
|
|
|
+$vsversion = 18;
|
|
|
|
|
|
# Normalize channel names (Stable=Release, Insiders=Preview, Dogfood=IntPreview)
|
|
|
switch ($Channel) {
|
|
|
@@ -84,26 +78,15 @@ if ("$Edition" -eq "BuildTools") {
|
|
|
$responseFileName += ".buildtools"
|
|
|
}
|
|
|
|
|
|
-# Channel URIs differ between VS 2022 and VS 2026+
|
|
|
-# VS 2022: release, pre, intpreview
|
|
|
-# VS 2026+: stable, insiders, intpreview (canary)
|
|
|
if ("$Channel" -eq "Preview") {
|
|
|
$responseFileName += ".preview"
|
|
|
- if ($vsversion -ge 18) {
|
|
|
- $channelUri = "https://aka.ms/vs/$vsversion/insiders"
|
|
|
- } else {
|
|
|
- $channelUri = "https://aka.ms/vs/$vsversion/pre"
|
|
|
- }
|
|
|
+ $channelUri = "https://aka.ms/vs/$vsversion/insiders"
|
|
|
} elseif ("$Channel" -eq "IntPreview") {
|
|
|
$responseFileName += ".intpreview"
|
|
|
$channelUri = "https://aka.ms/vs/$vsversion/intpreview"
|
|
|
} else {
|
|
|
# Release channel
|
|
|
- if ($vsversion -ge 18) {
|
|
|
- $channelUri = "https://aka.ms/vs/$vsversion/stable"
|
|
|
- } else {
|
|
|
- $channelUri = "https://aka.ms/vs/$vsversion/release"
|
|
|
- }
|
|
|
+ $channelUri = "https://aka.ms/vs/$vsversion/stable"
|
|
|
}
|
|
|
|
|
|
$responseFile = "$PSScriptRoot\$responseFileName.json"
|
|
|
@@ -130,15 +113,9 @@ if (-not $InstallPath) {
|
|
|
}
|
|
|
|
|
|
if (-not $InstallPath) {
|
|
|
- if (($vsversion -eq 17) -or ($vsversion -eq 18)) {
|
|
|
- $pathPrefix = "${env:ProgramFiles}";
|
|
|
- }
|
|
|
+ $pathPrefix = "${env:ProgramFiles}";
|
|
|
if ("$Channel" -eq "Preview") {
|
|
|
- if ($vsversion -ge 18) {
|
|
|
- $InstallPath = "$pathPrefix\Microsoft Visual Studio\$Version\${Edition}_Insiders"
|
|
|
- } else {
|
|
|
- $InstallPath = "$pathPrefix\Microsoft Visual Studio\$Version\${Edition}_Pre"
|
|
|
- }
|
|
|
+ $InstallPath = "$pathPrefix\Microsoft Visual Studio\$Version\${Edition}_Insiders"
|
|
|
} elseif ("$Channel" -eq "IntPreview") {
|
|
|
$InstallPath = "$pathPrefix\Microsoft Visual Studio\$Version\${Edition}_IntPre"
|
|
|
} else {
|