Skip to content

Commit

Permalink
Install Visual Studio: add support for preview (#11265)
Browse files Browse the repository at this point in the history
  • Loading branch information
alefranz authored and dougbu committed Jun 16, 2019
1 parent 1521e6f commit b528fd0
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 5 deletions.
29 changes: 24 additions & 5 deletions eng/scripts/InstallVisualStudio.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
Community
Professional
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
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
Expand All @@ -28,6 +32,8 @@
param(
[ValidateSet('BuildTools','Community', 'Professional', 'Enterprise')]
[string]$Edition = 'Enterprise',
[ValidateSet('Release', 'Preview')]
[string]$Channel = 'Release',
[string]$InstallPath,
[switch]$Passive,
[switch]$Quiet
Expand All @@ -52,15 +58,24 @@ mkdir $intermedateDir -ErrorAction Ignore | Out-Null

$bootstrapper = "$intermedateDir\vsinstaller.exe"
$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") {
$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

$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"
if (-not $InstallPath) {
$vsWhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
Expand All @@ -78,7 +93,11 @@ 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
Expand All @@ -103,7 +122,7 @@ if ($Quiet) {
}

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 "Running '$bootstrapper $arguments'"

Expand Down
28 changes: 28 additions & 0 deletions eng/scripts/vs.buildtools.preview.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
25 changes: 25 additions & 0 deletions eng/scripts/vs.preview.json
Original file line number Diff line number Diff line change
@@ -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"
]
}

0 comments on commit b528fd0

Please sign in to comment.