microsoft / dotnet-framework-docker

The repo for the official docker images for .NET Framework on Windows Server Core.
https://hub.docker.com/_/microsoft-dotnet-framework
MIT License
698 stars 335 forks source link

Installation URLs for VS tools aren't pinned to major/minor version #957

Closed mthalman closed 1 year ago

mthalman commented 2 years ago

The intention with the VS tools installation URLs in the SDK Dockerfiles is to be pinned to a specific major/minor version. This allows the community to build with an older version of the Dockerfile and get the expected older version of VS tools.

That's not what's currently happening however. The URL is pointing to a specific version of the bootstrapper. But that bootstrapper is configured to install the latest version. As an example, if the URL points to the VS 17.2 Build Tools bootstrapper, it will actually install VS 17.3 Builds Tools (assuming 17.3 is latest).

This is actually documented:

If you previously downloaded a bootstrapper file and want to verify what version it will install, here's how. In Windows, open File Explorer, right-click the bootstrapper file, choose Properties and then choose the Details tab. The Product version field will describe the channel and version that the bootstrapper will install. The version number should always be read as "latest servicing version of what is specified", and the channel is Current unless explicitly specified. So, a bootstrapper with a Product version of LTSC 17.0 will install the latest 17.0.x servicing release that is available on the 17.0 LTSC channel. A bootstrapper with a Product version that simply says Visual Studio 2022 will install the latest version of Visual Studio 2022 on the Current channel.

To fix this, the channel should be explicitly set when running the install.

mthalman commented 2 years ago

Visual Studio limits what we can do here with the channels that they provide. For VS 17, channels only exist for "Current" and each of the LTSC releases. The Current channel gets updated with each release; it essentially points to the latest version. Effectively, what this means is that we can't target a past Current release (e.g. 17.1). We're limited to only being able to pin to an LTSC version.

Given that we do want to install Current versions, not just LTSC versions, I think what this means is that this proposal is not doable.

Instead, I think we should update the Dockerfiles to remove the illusion that it's pinned to a version due to the use of a very specific-looking URL (e.g. https://download.visualstudio.microsoft.com/download/pr/dc2793e9-7b80-4f11-9e33-85833e8921a6/06293b7db26d35bf19253f8059bf9feeb97d34236c02970afd1931f5e4da6da7/vs_BuildTools.exe). And instead replace it with a more approachable and representative URL: https://aka.ms/vs/17/release/vs_buildtools.exe.

@MichaelSimons - LMK your throughts.

MichaelSimons commented 2 years ago

This is unfortunate as it breaks a key best practice of Dockerfiles. Given the limitation, I agree with your proposal that we should go with an approach that makes the behavior more transparent.

mthalman commented 1 year ago

This won't be implemented due to the lack of stable URLs from VS for each release. They only provide stable URLs for LTS versions.