Install Visual Studio: add support for preview (#11265)
This commit is contained in:
parent
1521e6fa72
commit
b528fd0a46
|
|
@ -9,6 +9,10 @@
|
||||||
Community
|
Community
|
||||||
Professional
|
Professional
|
||||||
Enterprise (the default)
|
Enterprise (the default)
|
||||||
|
.PARAMETER Channel
|
||||||
|
Selects which channel of Visual Studio to install. Must be one of these values:
|
||||||
|
Release (the default)
|
||||||
|
Preview
|
||||||
.PARAMETER InstallPath
|
.PARAMETER InstallPath
|
||||||
The location on disk where Visual Studio should be installed or updated. Default path is location of latest
|
The location on disk where Visual Studio should be installed or updated. Default path is location of latest
|
||||||
existing installation of the specified edition, if any. If that VS edition is not currently installed, default
|
existing installation of the specified edition, if any. If that VS edition is not currently installed, default
|
||||||
|
|
@ -28,6 +32,8 @@
|
||||||
param(
|
param(
|
||||||
[ValidateSet('BuildTools','Community', 'Professional', 'Enterprise')]
|
[ValidateSet('BuildTools','Community', 'Professional', 'Enterprise')]
|
||||||
[string]$Edition = 'Enterprise',
|
[string]$Edition = 'Enterprise',
|
||||||
|
[ValidateSet('Release', 'Preview')]
|
||||||
|
[string]$Channel = 'Release',
|
||||||
[string]$InstallPath,
|
[string]$InstallPath,
|
||||||
[switch]$Passive,
|
[switch]$Passive,
|
||||||
[switch]$Quiet
|
[switch]$Quiet
|
||||||
|
|
@ -52,15 +58,24 @@ mkdir $intermedateDir -ErrorAction Ignore | Out-Null
|
||||||
|
|
||||||
$bootstrapper = "$intermedateDir\vsinstaller.exe"
|
$bootstrapper = "$intermedateDir\vsinstaller.exe"
|
||||||
$ProgressPreference = 'SilentlyContinue' # Workaround PowerShell/PowerShell#2138
|
$ProgressPreference = 'SilentlyContinue' # Workaround PowerShell/PowerShell#2138
|
||||||
Invoke-WebRequest -Uri "https://aka.ms/vs/16/release/vs_$($Edition.ToLowerInvariant()).exe" -OutFile $bootstrapper
|
|
||||||
|
|
||||||
$responseFile = "$PSScriptRoot\vs.json"
|
$channelUri = "https://aka.ms/vs/16/release"
|
||||||
|
$responseFileName = "vs"
|
||||||
if ("$Edition" -eq "BuildTools") {
|
if ("$Edition" -eq "BuildTools") {
|
||||||
$responseFile = "$PSScriptRoot\vs.buildtools.json"
|
$responseFileName += ".buildtools"
|
||||||
|
}
|
||||||
|
if ("$Channel" -eq "Preview") {
|
||||||
|
$responseFileName += ".preview"
|
||||||
|
$channelUri = "https://aka.ms/vs/16/pre"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$responseFile = "$PSScriptRoot\$responseFileName.json"
|
||||||
$channelId = (Get-Content $responseFile | ConvertFrom-Json).channelId
|
$channelId = (Get-Content $responseFile | ConvertFrom-Json).channelId
|
||||||
|
|
||||||
|
$bootstrapperUri = "$channelUri/vs_$($Edition.ToLowerInvariant()).exe"
|
||||||
|
Write-Host "Downloading Visual Studio 2019 $Edition ($Channel) bootstrapper from $bootstrapperUri"
|
||||||
|
Invoke-WebRequest -Uri $bootstrapperUri -OutFile $bootstrapper
|
||||||
|
|
||||||
$productId = "Microsoft.VisualStudio.Product.$Edition"
|
$productId = "Microsoft.VisualStudio.Product.$Edition"
|
||||||
if (-not $InstallPath) {
|
if (-not $InstallPath) {
|
||||||
$vsWhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
|
$vsWhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
|
||||||
|
|
@ -78,7 +93,11 @@ if (-not $InstallPath) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (-not $InstallPath) {
|
if (-not $InstallPath) {
|
||||||
$InstallPath = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\$Edition"
|
if ("$Channel" -eq "Preview") {
|
||||||
|
$InstallPath = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\${Edition}_Pre"
|
||||||
|
} else {
|
||||||
|
$InstallPath = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\$Edition"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# no backslashes - this breaks the installer
|
# no backslashes - this breaks the installer
|
||||||
|
|
@ -103,7 +122,7 @@ if ($Quiet) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host
|
Write-Host
|
||||||
Write-Host "Installing Visual Studio 2019 $Edition" -f Magenta
|
Write-Host "Installing Visual Studio 2019 $Edition ($Channel)" -f Magenta
|
||||||
Write-Host
|
Write-Host
|
||||||
Write-Host "Running '$bootstrapper $arguments'"
|
Write-Host "Running '$bootstrapper $arguments'"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
{
|
||||||
|
"channelUri": "https://aka.ms/vs/16/pre/channel",
|
||||||
|
"channelId": "VisualStudio.16.Preview",
|
||||||
|
"includeRecommended": false,
|
||||||
|
"addProductLang": [
|
||||||
|
"en-US"
|
||||||
|
],
|
||||||
|
"add": [
|
||||||
|
"Microsoft.Net.Component.4.6.1.TargetingPack",
|
||||||
|
"Microsoft.Net.Component.4.6.2.TargetingPack",
|
||||||
|
"Microsoft.Net.Component.4.7.1.TargetingPack",
|
||||||
|
"Microsoft.Net.Component.4.7.2.SDK",
|
||||||
|
"Microsoft.Net.Component.4.7.2.TargetingPack",
|
||||||
|
"Microsoft.Net.Component.4.7.TargetingPack",
|
||||||
|
"Microsoft.VisualStudio.Component.FSharp.MSBuild",
|
||||||
|
"Microsoft.VisualStudio.Component.NuGet",
|
||||||
|
"Microsoft.VisualStudio.Component.NuGet.BuildTools",
|
||||||
|
"Microsoft.VisualStudio.Component.VC.ATL",
|
||||||
|
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
|
||||||
|
"Microsoft.VisualStudio.Component.Windows10SDK.17134",
|
||||||
|
"Microsoft.VisualStudio.Workload.ManagedDesktopBuildTools",
|
||||||
|
"Microsoft.VisualStudio.Workload.MSBuildTools",
|
||||||
|
"Microsoft.VisualStudio.Workload.NetCoreBuildTools",
|
||||||
|
"Microsoft.VisualStudio.Workload.VCTools",
|
||||||
|
"Microsoft.VisualStudio.Workload.VisualStudioExtensionBuildTools",
|
||||||
|
"Microsoft.VisualStudio.Workload.WebBuildTools"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
"channelUri": "https://aka.ms/vs/16/pre/channel",
|
||||||
|
"channelId": "VisualStudio.16.Preview",
|
||||||
|
"includeRecommended": false,
|
||||||
|
"addProductLang": [
|
||||||
|
"en-US"
|
||||||
|
],
|
||||||
|
"add": [
|
||||||
|
"Microsoft.Net.Component.4.6.1.TargetingPack",
|
||||||
|
"Microsoft.Net.Component.4.6.2.TargetingPack",
|
||||||
|
"Microsoft.Net.Component.4.7.1.TargetingPack",
|
||||||
|
"Microsoft.Net.Component.4.7.2.SDK",
|
||||||
|
"Microsoft.Net.Component.4.7.2.TargetingPack",
|
||||||
|
"Microsoft.Net.Component.4.7.TargetingPack",
|
||||||
|
"Microsoft.VisualStudio.Component.Azure.Storage.Emulator",
|
||||||
|
"Microsoft.VisualStudio.Component.VC.ATL",
|
||||||
|
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
|
||||||
|
"Microsoft.VisualStudio.Component.Windows10SDK.17134",
|
||||||
|
"Microsoft.VisualStudio.Workload.ManagedDesktop",
|
||||||
|
"Microsoft.VisualStudio.Workload.NativeDesktop",
|
||||||
|
"Microsoft.VisualStudio.Workload.NetCoreTools",
|
||||||
|
"Microsoft.VisualStudio.Workload.NetWeb",
|
||||||
|
"Microsoft.VisualStudio.Workload.VisualStudioExtension"
|
||||||
|
]
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue