Docker Community Forums

Share and learn in the Docker community.

Visual Studio Build Tools on Windows Server Core Container


(Alpacamybags) #1

Hi all,

I’ve been trying to make a build environment using the Windows Server Core image as a base. I’ve been able to successfully install Microsoft Build Tools 2015 on top of it, but I saw that for the Visual Studio 2017 rollout, they created an updated version. I wanted to use this updated version, but I can’t seem to get it to install. When I try to install, it just kind of sits there and does nothing. I let it sit for over an hour and nothing happens.

I’m downloading the installer from here:

I tried running both:

vs_buildtools.exe –quiet
vs_buildtools.exe –quiet –add Microsoft.VisualStudio.Workload.VCTools –includeOptional

Does anyone have experience installing this in server core? Any help would be appreciated!

(Michael Friis) #2

Here’s an example:

(Alpacamybags) #3

That worked! Thank you! Really appreciate the help!!

(Mandeepm91) #4

Thanks for the dockerfile. However I am getting DNS error. I can ping the host from my docker host machine. Not sure why this error is coming from the container?

Invoke-WebRequest : The remote name could not be resolved: ''
At line:1 char:76
+ ... yContinue'; Invoke-WebRequest ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:Htt
   pWebRequest) [Invoke-WebRequest], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShe

I am running this on a Windows 10 Desktop with docker for windows version 17.03. Also tried changing the download url to but that is also giving the same error. I tried to create a container using an intermediate layer of the image. From the container, I cannot ping the DNS host. Trying to ping gives this error:

PS C:\> ping
Ping request could not find host Please check the name and try again.


Strange thing happened later on. I switched to Linux Containers mode and tried with an ubuntu container. It worked fine. Then I switched back to Windows Containers mode and this time everything worked fine. Although my issue was resolved, I don’t understand what caused the issue in the first place ?

(Harrisq) #5


Can this also be used please if i want to run Visual Studio inside a Windows Container on macOS Sierra with Windows Server 2016 TP5 running inside VirtualBox alongside Docker?

Basically, i am on a mac and want to be able to build and run C#/Python application using Visual Studio and Visual Studio (Mac) doesn’t support the functionality i require so thought i might be able to do inside VirtualBox with TP5 set-up.

(Alpacamybags) #6

You should be able to. If you are looking to just purely build, build tools would be a more light-weight option than a full on Visual Studio install, but both are possible.

I have a “small” container here for performing builds via VS Build Tools:

(I would link my dockerfile, but github seems to be down at the moment…)

(Harrisq) #7


Thank you.

Image downloaded fine.

Do you know of any blogs/guidance showing how to use this please? I am a newbie i’m afraid.
Normally i would open Visual Studio and fire up a template. Is it something similar using this image? I would actually run the application as well from here.

I am trying to complete the following exercise:

The solution file needs Visual Studio (Windows).

(Alpacamybags) #8

So, everything you could do within Visual Studio in a container would be command-line based, so you would be limited to what you can execute using the devenv.exe file (aka Visual Studio). It looks like that example is creating an app that is using what looks like WinForm, you wouldn’t actually be able to run it from the container itself.

If you are already using Windows Server 2016 directly in a VM, you’d be better off just installing Visual Studio within that and building/running the solution.

If you wanted to use the image to build, the easiest way to go about it would to put the solution files in a directory in the server 2016 VM, and start an interactive session with the container w/ that directory mounted to the container as a volume. You would use this command to do so.

docker run -it -v (directory of solution):C:\Solution alpacamybags/msbuildlite

Once the container is running, you would just invoke MSBuild, point to the solution, and just provide any arguments you need

msbuild C:\Solution(SolutionName.sln) (additional arguments)

The compiled code with be within the (directory of solution)\bin on your server 2016 VM once the compilation is complete

(Harrisq) #9

Thank you. That’s incredibly helpful and i really appreciate the command examples.

(Tbertenshaw) #10

I’m trying to install the build tools to the jetbrains/teamcityagent (

After running the docker image and connecting via powershell I cannot install the build tools using the example in your script. (after downloading the image) Running the code on line 7 or just running without start process. And the command prompt just returns immediately without any errors.