microsoft/dotnet-framework-docker

4.8-windowsservercore-ltsc2019 broken for visual studio 2019 installs

benknight135 opened this issue · 5 comments

Describe the Bug

Dockerfile breaks after latest update to FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019.

Steps to Reproduce

This a basic implementation of what I have in my dockerfile:

FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019

# Install Visual Studio
SHELL ["cmd", "/S", "/C"]
RUN \
    # Download the Build Tools bootstrapper.
    curl -SL --output vs_buildtools.exe https://aka.ms/vs/16/release/vs_buildtools.exe \
    # Install Build Tools with the Microsoft.VisualStudio.Workload.AzureBuildTools workload, excluding workloads and components with known issues.
    && (start /w vs_buildtools.exe --quiet --wait --norestart --nocache modify \
        --installPath "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools" \
        --add Microsoft.VisualStudio.Workload.MSBuildTools \
        --add Microsoft.VisualStudio.Workload.VCTools -includeRecommended \
        --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 \
        --add Microsoft.VisualStudio.Component.Windows10SDK.19041 \
        --add Microsoft.VisualStudio.Component.VC.CMake.Project \
        --add Microsoft.VisualStudio.Component.TestTools.BuildTools \
        --remove Microsoft.VisualStudio.Component.Windows10SDK.10240 \
        --remove Microsoft.VisualStudio.Component.Windows10SDK.10586 \
        --remove Microsoft.VisualStudio.Component.Windows10SDK.14393 \
        --remove Microsoft.VisualStudio.Component.Windows81SDK \
        || IF "%ERRORLEVEL%"=="3010" EXIT 0) \
    \
    # Cleanup
    && del /q vs_buildtools.exe

ENTRYPOINT ["C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\Common7\\Tools\\VsDevCmd.bat", "&&", "powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]

If I use the latest mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019 this doesn't work but if I use mcr.microsoft.com/dotnet/framework/sdk:4.8-20211012-windowsservercore-ltsc2019 it does. I think this co-insided with the release of visual studio 2022 but this surely shouldn't break existing images especially as this image was tagged as ltsc2019. I still need to use vs2019.

Other Information

Output of docker version

Client:
 Cloud integration: v1.0.22
 Version:           20.10.12
 API version:       1.41
 Go version:        go1.16.12
 Git commit:        e91ed57
 Built:             Mon Dec 13 11:44:07 2021
 OS/Arch:           windows/amd64
 Context:           default
 Experimental:      true

Server: Docker Desktop 4.5.1 (74721)
 Engine:
  Version:          20.10.12
  API version:      1.41 (minimum version 1.24)
  Go version:       go1.16.12
  Git commit:       459d0df
  Built:            Mon Dec 13 11:42:13 2021
  OS/Arch:          windows/amd64
  Experimental:     false

Output of docker info

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.7.1)
  compose: Docker Compose (Docker Inc., v2.2.3)
  scan: Docker Scan (Docker Inc., v0.17.0)

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 10
 Server Version: 20.10.12
 Storage Driver: windowsfilter
  Windows:
 Logging Driver: json-file
 Plugins:
  Volume: local
  Network: ics internal l2bridge l2tunnel nat null overlay private transparent
  Log: awslogs etwlogs fluentd gcplogs gelf json-file local logentries splunk syslog
 Swarm: inactive
 Default Isolation: hyperv
 Kernel Version: 10.0 19044 (19041.1.amd64fre.vb_release.191206-1406)
 Operating System: Windows 10 Pro Version 2009 (OS Build 19044.1586)
 OSType: windows
 Architecture: x86_64
 CPUs: 20
 Total Memory: 31.91GiB
 Name: DESKTOP-GKOU0DB
 ID: 2MQG:A3MZ:B2PJ:62DU:UVVA:RUDZ:YY5K:PEVR:TQPT:6IYC:WE47:PIZI
 Docker Root Dir: C:\ProgramData\Docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine

If I use the latest mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019 this doesn't work

Can you provide more details on what doesn't work?

I think this co-insided with the release of visual studio 2022 but this surely shouldn't break existing images especially as this image was tagged as ltsc2019. I still need to use vs2019.

The VS Tools in sdk images were updated to VS 2022 in the November update. See #848. The ltsc2019 in the tag refers to the Windows Server version, not the Visual Studio version.

Ah, I see you're using the modify command in your installation. That would explain why it's not working. There's no installation of VS 2019 to modify since it now contains VS 2022. If you absolutely require VS 2019, you'd need to do a separate installation of VS 2019, not a modification.

Can you provide more details on what doesn't work?

There is nothing in the Visual Studio 2019 folder after install. I will try re-running and respond with the the error logs.

The VS Tools in sdk images were updated to VS 2022 in the November update. See #848. The ltsc2019 in the tag refers to the Windows Server version, not the Visual Studio version.

Sorry I misunderstood the naming. Is there a stable tag for using VS tools 2019 or should I continue to use mcr.microsoft.com/dotnet/framework/sdk:4.8-20211012-windowsservercore-ltsc2019?

Ah, I see you're using the modify command in your installation. That would explain why it's not working. There's no installation of VS 2019 to modify since it now contains VS 2022. If you absolutely require VS 2019, you'd need to do a separate installation of VS 2019, not a modification.

I will try removing the modify and report back.

Sorry I misunderstood the naming. Is there a stable tag for using VS tools 2019 or should I continue to use mcr.microsoft.com/dotnet/framework/sdk:4.8-20211012-windowsservercore-ltsc2019?

No, we don't maintain any Dockerfiles that install VS 2019. Once a new version of VS is released, we update to use that version. So mcr.microsoft.com/dotnet/framework/sdk:4.8-20211012-windowsservercore-ltsc2019 would be the last update that contained VS 2019 tools. But that tag is not considered supported anymore; it's not getting any Windows monthly security updates, for example.

Can I ask what your requirement is on the VS 2019 tools that is not provided by the VS 2022 tools?

I reviewed my need for VS 2019 and didn't realise I could install toolsets from previous versions. Going forward I will use VS 2022 and add the v142 toolset for compatibility with dependencies. I also reverted to using the servercore to remove any uneeded installs using your image as guidence. Thank you for your help.
For anyone else wanting to do this the Microsoft.VisualStudio.ComponentGroup.VC.Tools.142.x86.x64 component should be installed like the example below for this to work:

curl -fSLo vs_BuildTools.exe https://aka.ms/vs/17/release/vs_buildtools.exe `
    && start /w vs_BuildTools ^ `
        --add Microsoft.VisualStudio.Workload.MSBuildTools ^ `
        --add Microsoft.VisualStudio.Workload.VCTools ^ `
        --add Microsoft.VisualStudio.ComponentGroup.VC.Tools.142.x86.x64 ^ `
        --add Microsoft.VisualStudio.Component.Windows10SDK.19041 ^ `
        --remove Microsoft.VisualStudio.Component.Windows10SDK.10240 ^ `
        --remove Microsoft.VisualStudio.Component.Windows10SDK.10586 ^ `
        --remove Microsoft.VisualStudio.Component.Windows10SDK.14393 ^ `
        --remove Microsoft.VisualStudio.Component.Windows81SDK ^ `
        --quiet --norestart --nocache --wait `
    && powershell -Command "if ($err = dir $Env:TEMP -Filter dd_setup_*_errors.log | where Length -gt 0 | Get-Content) { throw $err }" `
    && del vs_BuildTools.exe `