Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that VS is installed correctly #1736

Merged
merged 1 commit into from
Jul 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions scripts/install-vs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,38 @@ Param(

$ErrorActionPreference = 'Stop'

Write-Host "Downloading Visual Studio..."
$startTime = Get-Date

Write-Host "Downloading Visual Studio Installer..."
Invoke-WebRequest -UseBasicParsing `
-Uri "https://aka.ms/vs/install/latest/vs_setup.exe" `
-OutFile "$env:TEMP\dd_vs_setup.exe"

Write-Host "Updating the Visual Studio Installer..."
$exitCode = & "$env:TEMP\dd_vs_setup.exe" --update --quiet --wait | Out-Null

Write-Host "Exit code: $exitCode"

Write-Host "Downloading Visual Studio ($Version)..."
Invoke-WebRequest -UseBasicParsing `
-Uri "https://aka.ms/vs/$Version/vs_community.exe" `
-OutFile vs_community.exe
-OutFile "$env:TEMP\dd_vs_community.exe"

Write-Host "Installing Visual Studio..."
./vs_community.exe --passive --norestart --wait `
$exitCode = & "$env:TEMP\dd_vs_community.exe" --quiet --norestart --wait `
--add Microsoft.VisualStudio.Workload.NetCrossPlat `
--add Microsoft.VisualStudio.Workload.NetCoreTools `
--add Microsoft.VisualStudio.Workload.ManagedDesktop `
--add Microsoft.VisualStudio.Workload.Universal `
| Out-Null

Remove-Item vs_community.exe
Write-Host "Exit code: $exitCode"

$vsLogs = 'output\vs-logs'
New-Item -ItemType Directory -Force -Path "$vsLogs" | Out-Null
Get-ChildItem "$env:TEMP\dd_*" |
Where-Object { $_.CreationTime -gt $startTime } |
Copy-Item -Destination "$vsLogs"

$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"

Expand Down