ChocolateyPackages
ChocolateyPackages copied to clipboard
Create deterministic versions of VS packages
These pages: https://docs.microsoft.com/en-us/visualstudio/productinfo/installing-an-earlier-release-of-vs2017 https://docs.microsoft.com/en-us/visualstudio/releases/2019/history contain links to bootstrappers linked to specific versions of channel manifests, which opens up the possibility of creating packages which always reliably install the same VS version.
Source: http://disq.us/p/1wfvq8j
This idea won't work for community edition since the legacy bootstrappers are not uploaded.
But could a package parameter of "exactVersion" be included which makes the installer create a temporary offline installer from the correct bootstrapper then install visual studio using that?
I'm deploying using Octopus powershell script & chocolatey. My deploy pulls the bootstrapper, creates an offline installer and then calls your choco package passing the offline installer location.
Would be great if this could be included as native!
@BlythMeister could you share your script and chocolatey options please? I need to install baseline version (16.7 for vs2019 currently) and since 16.8 release I cannot use chocolatey for installation in docker anymore.
The offline installer is created using the packaged vs_BuildTools.exe which was downloaded from https://docs.microsoft.com/en-us/visualstudio/releases/2019/history
I call that exe to create an offline installer as described here: https://docs.microsoft.com/en-us/visualstudio/install/create-an-offline-installation-of-visual-studio?view=vs-2019#step-2---create-a-local-install-cache
Then I call the chocolatey package with the --bootstrapperPath argument to the offline installer exe. And --noWeb.
I am doing all workloads, but you can specify them.
I also found that I needed the includeOptional and includeRecommended flags.
In my script, I am downloading the offline installer into a network share, that way all machines can use it. But obviously, if your just running on 1 machine, that's a bit ott.
It took me a while to get it right, so I'll publish command which setup vc++ 16.7.8 build tools as initially I was not calling visualstudio2019buildtools and was using the same path in layout and bootstrapperPath and they are not the same. So this command:
cinst visualstudio2019-workload-vctools --params "--add Microsoft.VisualStudio.Component.VC.ATLMFC"
installing 16.8.2 currently, and these:
cinst visualstudio2019buildtools --params "--bootstrapperPath \\server\vs_BuildTools_16.7\vs_BuildTools.exe --noweb"
cinst visualstudio2019-workload-vctools --params "--add Microsoft.VisualStudio.Component.VC.ATLMFC --bootstrapperPath \\server\vs_BuildTools_16.7\vs_BuildTools.exe --noweb"
installing 16.7.8, network share was created with
start /wait vs_BuildTools_16.7.exe --layout \\server\vs_BuildTools_16.7 --lang en-US --wait --quiet
The only minor issue that visualstudio2019buildtools has version 16.8.2.0, so I've created local 16.7.8.0 version - https://github.com/isanych/ChocolateyPackages/commit/5b22970df9c4319b5631dbe24daf4e1d1bb08e59 I'm using next commands in Dockerfile currently:
cinst --source="'\\server\vs_BuildTools_16.7;https://chocolatey.org/api/v2'" --version 16.7.8.0 visualstudio2019buildtools --params "--bootstrapperPath \\server\vs_BuildTools_16.7\vs_BuildTools.exe --noweb"
cinst visualstudio2019-workload-vctools --params "--add Microsoft.VisualStudio.Component.VC.ATLMFC --bootstrapperPath \\server\vs_BuildTools_16.7\vs_BuildTools.exe --noweb"
del /q %ChocolateyInstall%\logs\*
rmdir /s/q "%ProgramData%\Package Cache"
My custom package also working without prepared network share, but it is faster to install from network and I'm not sure if incorrect channel
Downloading channel manifest
from 'https://aka.ms/vs/16/release/channel'
Download of ChannelManifest_-602808024.man (128.8 KB) completed.
Downloading catalog manifest
from 'https://download.visualstudio.microsoft.com/download/pr/9d2147aa-7b01-4336-b665-8fe07735e5ee/c7464474134c0a53c3dc7d66ce09bd7f00df721146e8578ab6961a75fcf21194/VisualStudio.vsman'
Download of Catalog_-1751506352.man (9.65 MB) completed.
will cause issues down the road, so I'll continue to use network share.
This idea won't work for community edition since the legacy bootstrappers are not uploaded.
Actually, all that's needed are the proper channel and component manifest json files. The bootstrappers are data-driven, so the json files together with any bootstrapper can be used to install any product (Enterprise/Professional/Community/...).
One caveat is that it will only be possible to install a new instance of a specific older VS version, it will not be possible to upgrade an existing instance to a specific older version (because the VS Installer accepts the --installChannelUri
argument only for the install
command, not for update
).
I intend to:
- bump the major version numbers of the current packages (which always install the latest version) to 100+ range, e.g. 116.8.2 instead of 16.8.2
- (eventually, when I have time) develop and release packages which will install specific, older versions, based on the channel manifest urls extracted from the bootstrappers published by MS - those packages will have version numbers corresponding to the actual VS versions installed by them
- those latter packages will not support upgrading existing instances (I'm still undecided whether the packages should install successfully but do nothing or if they should fail with a descriptive error message)