4
votes

With the current microsoft/aspnetcore-build:2.0 (or simimarly tag 2.0.2) Docker container image, it always takes at least 20 seconds to build even a simple ASP.NET Core app.

As I got to know that the next version of msbuild will be focusing on major performance improvements, I tried it out. Apart of the current Visual Studio 2017 15.5 Preview (15.5.0 version 1.0) comes version 15.5.113.63837 of msbuild. And indeed, this version only takes at most 10 seconds to build a simple app, which is an impressive improvement!

How should I proceed in order to integrate this latest version of msbuild in my Dockerfile pipeline? Is it easy to wire up the current dotnet 2.0.2 sdk with the latest msbuild? Maybe there is a specific tag available to really get the latest msbuild / dotnet sdk?

Specifications of my machine:

  • Windows Version: 10.0.15063 Build 15063
  • System SKU: LENOVO_MT_20CJ_BU_Think_FM_ThinkPad T550
  • Installed Physical Memory (RAM): 32,0 GB
  • Processor: Intel(R) Core(TM) i7-5600U CPU @ 2.60GHz, 2594 Mhz, 2 Core(s), 4 Logical Processor(s)
  • Disk Model: Samsung SSD 840 EVO 500GB
1

1 Answers

4
votes

How should I proceed in order to integrate this latest version of msbuild in my Dockerfile pipeline?

You can install the Build Tools into a Docker container by using a Dockerfile. Such as the example code below:

# ENV TEST_CONTAINER=1 \
VS_BUILDTOOLS_URI=https://aka.ms/vs/15/release/799c44140/vs_buildtools.exe \
VS_BUILDTOOLS_SHA256=FA29EB83297AECADB0C4CD41E54512C953164E64EEDD9FB9D3BF9BD70C9A2D29 \

 Download vs_buildtools.exe
RUN $ErrorActionPreference = 'Stop'; \
    $ProgressPreference = 'SilentlyContinue'; \
    $VerbosePreference = 'Continue'; \
    Invoke-WebRequest -Uri $env:VS_BUILDTOOLS_URI -OutFile C:\vs_buildtools.exe; \
    if ((Get-FileHash -Path C:\vs_buildtools.exe -Algorithm SHA256).Hash -ne $env:VS_BUILDTOOLS_SHA256) { throw 'Download hash does not match' }

# Install Visual Studio Build Tools
RUN $ErrorActionPreference = 'Stop'; \
    $VerbosePreference = 'Continue'; \
    $p = Start-Process -Wait -PassThru -FilePath C:\vs_buildtools.exe -ArgumentList '--quiet --nocache --wait --installPath C:\BuildTools'; \
    if ($ret = $p.ExitCode) { c:\collect.exe; throw ('Install failed with exit code 0x{0:x}' -f $ret) }

You can change the VS_BUILDTOOLS_URI to the download path of latest version of msbuild.

See Install Build Tools into a Container and 3 Steps to MSBuild with Docker for more detail info.