Skip to content

Instantly share code, notes, and snippets.

@thejohnfreeman
Last active February 12, 2022 10:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thejohnfreeman/2a64c63f09847ce5ed338fb540dcfc02 to your computer and use it in GitHub Desktop.
Save thejohnfreeman/2a64c63f09847ce5ed338fb540dcfc02 to your computer and use it in GitHub Desktop.
Trying to install anything from Visual Studio in a Docker container

All of these commands print nothing and return immediately. They were all executed in a container built from the Dockerfile:

> docker build . -t sandbox
> docker run --rm -it sandbox

Clearly I'm just shooting in the dark here.

FROM mcr.microsoft.com/dotnet/framework/sdk:4.8
# Use the latest release channel.
ADD https://aka.ms/vs/16/release/channel C:\TEMP\VisualStudio.chman
# Download the Visual Studio Build Tools bootstrapper.
ADD https://aka.ms/vs/16/release/vs_buildtools.exe C:\TEMP\vs_buildtools.exe
# Download the Visual Studio Community bootstrapper.
ADD https://aka.ms/vs/16/release/vs_community.exe C:\TEMP\vs_community.exe
# Using the Visual Studio Build Tools installer to install Visual C++
cmd /S /C C:\TEMP\vs_buildtools.exe --help
cmd /S /C C:\TEMP\vs_buildtools.exe --wait --norestart --installPath C:\BuildTools --channelUri C:\TEMP\VisualStudio.chman --installChannelUri C:\TEMP\VisualStudio.chman --add
Microsoft.VisualStudio.Workload.VCTools
cmd /S /C C:\TEMP\vs_buildtools.exe --wait --norestart --installPath C:\BuildTools --channelUri C:\TEMP\VisualStudio.chman --installChannelUri C:\TEMP\VisualStudio.chman --add
Microsoft.VisualStudio.Workload.VCTools || IF "%ERRORLEVEL%"=="3010" EXIT 0
start "" /wait C:\TEMP\vs_buildtools.exe --wait --norestart --installPath C:\BuildTools --add Microsoft.VisualStudio.Workload.VCTools
START "" /WAIT C:\TEMP\vs_buildtools.exe --wait --norestart --installPath C:\BuildTools --add Microsoft.VisualStudio.Workload.VCTools
# Using the Visual Studio Community installer to install Python
cmd /S /C C:\TEMP\vs_community.exe --wait --norestart --installPath C:\Python --add Component.CPython3.x64
cmd /S /C C:\TEMP\vs_community.exe --wait --norestart --add Component.CPython3.x64
cmd /S /C C:\TEMP\vs_community.exe --wait --norestart --installPath C:\Python --channelUri C:\TEMP\VisualStudio.chman --add Component.CPython3.x64
cmd /S /C C:\TEMP\vs_community.exe --wait --norestart --installPath C:\Python --channelUri C:\TEMP\VisualStudio.chman --add Component.CPython3.x64 || IF "%ERRORLEVEL%"=="3010"
EXIT 0
cmd /S /C C:\TEMP\vs_community.exe --wait --norestart --installPath C:\Python --channelUri C:\TEMP\VisualStudio.chman --installChannelUri C:\TEMP\VisualStudio.chman --add Compo
nent.CPython3.x64 || IF "%ERRORLEVEL%"=="3010" EXIT 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment