Is it possible to install Visual Studio in a Windows Container Is it possible to install Visual Studio in a Windows Container docker docker

Is it possible to install Visual Studio in a Windows Container


Visual Studio seems to not be supported officially on Core Server, but I agree it would be really nice to be able to do this. Let's try:

FROM mcr.microsoft.com/windows/servercore:ltsc2019SHELL ["powershell"]RUN Invoke-WebRequest "https://aka.ms/vs/16/release/vs_community.exe" -OutFile "$env:TEMP\vs_community.exe" -UseBasicParsingRUN & "$env:TEMP\vs_community.exe" --add Microsoft.VisualStudio.Workload.NetWeb --quiet --wait --norestart --noUpdateInstaller | Out-DefaultRUN & 'C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/MSBuild/15.0/Bin/MSBuild.exe' /versionCMD ["powershell"]

(I'm pushing this image into lukaslansky/visualstudio-netwebworkload, use with caution.)

Output of the build is:

[...]Microsoft (R) Build Engine version 15.3.409.57025 for .NET FrameworkCopyright (C) Microsoft Corporation. All rights reserved.

So this seems to work! You should play with those --add installator arguments to specify what components you need precisely for your build, they correspond to workloads and components you see in the GUI. See the documentation.


A way to install visual build chain in a windows container could be to use chocolatey package visualstudio2017buildtools.

Starting Dockerfile with something like :

FROM microsoft/windowsservercoreRUN powershell.exe -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SETX PATH "%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" RUN choco install -y  visualstudio2017buildtools --package-parameters "--add Microsoft.VisualStudio.Workload.VCTools --installPath C:\BuildTools" || IF "%ERRORLEVEL%"=="3010" EXIT 0      RUN call "C:\BuildTools\VC\Auxiliary\Build\vcvars64.bat"


Windows Containers do not currently include GUI apps. The limitation is on Microsoft, not on Docker.

For example try something simple like running Notepad (in Windows Server Core container). The process is launched but no GUI shows up.

Notepad launched, but no GUI shows up