Skip to content

Instantly share code, notes, and snippets.

@jedieaston
Created March 20, 2021 00:56
Show Gist options
  • Save jedieaston/dbed1cfd8516e3f50786257d2520715e to your computer and use it in GitHub Desktop.
Save jedieaston/dbed1cfd8516e3f50786257d2520715e to your computer and use it in GitHub Desktop.
A script to update Visual Studio in the winget repo (requires WinGetHelpers)
# Change these first!
$TARGETVERSION = "16.9.31112.23"
$BASEVERSION = "16.9.31105.61"
$root = "C:\Users\Easton Pillay\projects\winget-pkgs\manifests\Microsoft\VisualStudio"
$BASEMANIFEST = ".\" + $BASEVERSION + ".yaml"
$baseParams = @{
manifest = $BASEMANIFEST;
newVersion = $TARGETVERSION;
silentTest = $true;
commit = $false;
}
$urls = @{
BuildTools = @{
newURL = "https://aka.ms/vs/16/release/vs_buildtools.exe";
};
Community = @{
newURL = "https://aka.ms/vs/16/release/vs_community.exe";
};
Enterprise = @{
newURL = "https://aka.ms/vs/16/release/vs_enterprise.exe";
};
Professional = @{
newURL = "https://aka.ms/vs/16/release/vs_professional.exe";
};
TeamExplorer = @{
newURL = "https://aka.ms/vs/16/release/vs_teamexplorer.exe";
};
TestAgent = @{
newURL = "https://aka.ms/vs/16/release/vs_testagent.exe ";
};
TestController = @{
newURL = "https://aka.ms/vs/16/release/vs_testcontroller.exe";
};
}
$ErrorActionPreference = "Stop"
$root = "C:\Users\Easton Pillay\projects\winget-pkgs\manifests\Microsoft\VisualStudio"
Set-Location $root
$folders = Get-ChildItem -Directory
foreach($i in $folders) {
if($i.name -eq "RemoteTools") { continue; }
Set-Location $i
Write-Host "Working on $i..." -ForegroundColor Yellow
$url = $urls[$i.name]
# Get the real URL without any of that stoopid link shortner crap.
$url.newURL = (Invoke-WebRequest -Method Get -Uri $url.newURL -MaximumRedirection 0 -ErrorAction SilentlyContinue).Headers.Location
Update-WinGetManifest @baseParams @url
# if(Update-WinGetManifest @baseParams @url) { git push -u origin; qpr; }
Set-Location $root
Write-Host "All done with $i!" -ForegroundColor Green
}
Write-Host "All done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment