I am trying to create a windows docker container for a VS2015 C++ build. I found some documentation how to install build tools in a container and it works for VS2017.
However, when trying to setup the 2015 version, MSBuild.exe complains that it cannot find v140 and despite adding --add Microsoft.VisualStudio.Component.VC.v140
to the vs_buildtools.exe
call. I also was not able to find any v140 cl.exe
in any of the subfolders.
Obviously, GUI based solutions like this are not an option.
Here is my changed Dockerfile:
# escape=`
# Use the latest Windows Server Core image with .NET Framework 4.8.
FROM mcr.microsoft.com/windows/servercore:1903
# Restore the default Windows shell for correct batch processing.
SHELL ["cmd", "/S", "/C"]
ARG BUILD_TOOLS_VERSION=16
# Download the Build Tools bootstrapper.
ADD https://aka.ms/vs/${BUILD_TOOLS_VERSION}/release/vs_buildtools.exe C:\TEMP\vs_buildtools.exe
RUN C:\TEMP\vs_buildtools.exe --quiet --wait --norestart --nocache `
--installPath C:\BuildTools `
--add Microsoft.VisualStudio.Workload.VCTools `
--add Microsoft.VisualStudio.Component.VC.CLI.Support `
--add Microsoft.VisualStudio.Component.VC.v140 `
--add Microsoft.VisualStudio.Component.Windows10SDK.18362 `
--add Microsoft.VisualStudio.Component.VC.CMake.Project `
|| IF "%ERRORLEVEL%"=="3010" EXIT 0
# put MSBuild.exe on PATH
RUN setx path "%path%;C:\BuildTools\MSBuild\Current\Bin"
# Define the entry point for the docker container.
# This entry point starts the developer command prompt and launches the PowerShell shell.
ENTRYPOINT ["C:\\BuildTools\\Common7\\Tools\\VsDevCmd.bat", "&&", "powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]