-
Notifications
You must be signed in to change notification settings - Fork 52
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
Installing specific versions does not work #100
Comments
I have the same problem. It always installs the latest version. I tried to install 16.8.5 and 16.8.6, but the installed version is always 16.9.2 which is the current latest version. I looked at the history of its ChocolateyInstall.ps1 file (here) and downloaded the "vs_BuildTools.exe" binaries from all 3 versions I mentioned above. The binaries are different, but once launched they all try to install 16.9.2. Below is the screenshot of the title of the window when vs_BuildTools.exe for 16.8.5 is launched. Current version (16.9.x) has a breaking change that fails the build when a solution contains WiX projects, which was tolerated in the older (16.8.5) version. Is there a way to install an older version of Build Tools? A specific parameter to the vs_BuildTools.exe or something? |
OK, I just found in the Release Notes that "the native installer always installs the latest released Visual Studio 2019 build", so apparently "this is not a bug, it is a feature" applies here, too. Still, is there a way to install an older version of this package? A parameter to the vs_BuildTools.exe or something? I found that here is a "--productId" parameter that can be passed to the binary, but I can't find the list of product Id's. |
That is correct. Because of the way Microsoft designed the Visual Studio installer program, the packages on chocolatey.org will always install the latest VS version. The reason is that the executables downloaded by the packages (from urls published by Microsoft) are just tiny, simple bootstrappers which only download the real VS Installer (the latest version of it) and invoke it. The VS Installer, in turn, is driven by two data files (the "channel manifest", https://aka.ms/vs/16/release/channel, and the "component catalog", linked from the channel manifest; they specify the exact versions of the components to be installed) which the Installer downloads from a specific address. Those files are updated by Microsoft in-place whenever an update of VS is released. There is a documented way of installing an earlier Visual Studio version, but it requires prior preparation. You can create an offline installation source ("layout") - a local cache of Visual Studio installation files. If you do it today, you will have a set of files which can be used to install VS 2019 16.9.3. The packages on chocolatey.org can both create such an offline source and install from it. Example command lines are provided here (the syntax for 2019 is the same as for 2017). But there is no time machine, sorry - today you cannot create an offline source for a past VS 2019 release. Now, it is technically possible (albeit undocumented and probably not supported by Microsoft) to install an earlier VS release using only those two data files mentioned earlier, instead of keeping a full, multi-gigabyte offline installation source. The VS installer parameters |
If I understand correctly, that last option also needs old Channel Manifest and Component Catalog files to be already kept around. So it's not possible to use those parameters without a time machine either. I may have sort of a "time machine" lying around, though... I still have container images with correct version of build tools installed; maybe I can salvage the files from there. Thank very much you for detailed explanation, Jakub! |
You're welcome :) Yes, that last option also needs the old files. Its benefit is only in reducing the amount of data to be stored. I believe the VS Installer caches the data files under |
Oh, I've just accidentally stumbled upon this: https://docs.microsoft.com/en-us/visualstudio/releases/2019/history#installing-an-earlier-release It would take some effort to change the packages to use those installers and I'm not sure how it would work for upgrades, but it may help in your scenario. The bootstrappers are self-extracting zip archives which can be unpacked using, for example, Total Commander. Then you can get the channel manifest link from vs_setup_bootstrapper.json and pass it as --installChannelUri, for example
installs VS Build Tools 16.7.4. |
This is exactly what I needed! I tried to pass the About updating the chocolatey package: Maybe it's enough to update the package description with the sentence in the Release Notes so it is not a surprise, and add a link to this issue so that people who need old versions can find the solution easily. |
Well, ideally I would like to have the cake and eat it, so to speak. That is, retain the ability to easily install the latest VS and upgrade to it, but at the same time be able to install a specific, older version. Design considerations:
|
Here is a wild idea:
|
One scenario which would offer a slightly worse UX in the above design is the case of a workload package depending on a minimum version of the main product, such as was the case with several VS 2017 Build Tools workloads, added in minor VS versions. Fortunately, there is no such workload in VS 2019 yet (and probably will not be added this late in the lifetime of the product). Correction: no, on second thought, the UX would not change. Thanks to Chocolatey dependency resolution (always latest version), Build Tools would still be upgraded to the latest version (using the "latest" package). |
Is this still valid? I'm trying with vs 2022 and the installer fails. |
Looks like it was not working because I was installing in the default place and the previous container already had a version there. It worked with a custom |
Can you paste here the full command pls ? |
a custom
Still installs VS 117.10 |
Check if |
I'm afraid not. In https://github.com/jberezanski/ChocolateyPackages/blob/master/visualstudio2022enterprise/tools/ChocolateyInstall.ps1#L4 Would probably be enough to let us pass a link to a custom release channel https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-history#release-dates-and-build-numbers based on version we pass |
Check https://github.com/FirebirdSQL/firebird/blob/master/builds/docker/windows/Dockerfile (and its history) to see how I did (and fixed) it. |
@Breee I experimented with this yesterday and the following command worked:
This installs VS 17.9.7 Build Tools. I extracted the channel URI by grabbing an exe of v17.9.7 on MS's VS 2022 builds page. Then, I used 7zip's From there, I copied the The |
I tested this on multiple PC's and it seems that the version specified is ignored and 16.9.0 is the default.
PS C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin> choco install visualstudio2019buildtools --version=16.8.3.0
PS C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin> .\MSBuild -version
Microsoft (R) Build Engine version 16.9.0+57a23d249 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
16.9.0.11203
The text was updated successfully, but these errors were encountered: