nvu
nvu

Reputation: 157

Trying to install Visual Studio 2019 Build Tools into Docker image

I’m trying to install Visual Studio Build Tools 2019 (version 16_4_5) into Docker but nothing gets installed.

I have followed the instruction from Microsoft (https://learn.microsoft.com/de-de/visualstudio/install/build-tools-container?view=vs-2019) with the following buildfile

# escape=`

# Use the latest Windows Server Core image with .NET Framework 4.8.
FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019

# Restore the default Windows shell for correct batch processing.
SHELL ["cmd", "/S", "/C"]

# Install build tools 16.4.5
ADD https://download.visualstudio.microsoft.com/download/pr/378e5eb4-c1d7-4c05-8f5f-55678a94e7f4/b9619acc0f9a1dfbdc1b67fddf9972e169916ceae237cf95f286c9e5547f804f/vs_BuildTools.exe C:\TEMP\vs_buildtools.exe

# Install Build Tools with the Microsoft.VisualStudio.Workload.AzureBuildTools workload, excluding workloads and components with known issues.
RUN C:\TEMP\vs_buildtools.exe --quiet --wait --norestart --nocache `
    --installPath C:\BuildTools `
    --add Microsoft.VisualStudio.Workload.AzureBuildTools `
    --remove Microsoft.VisualStudio.Component.Windows10SDK.10240 `
    --remove Microsoft.VisualStudio.Component.Windows10SDK.10586 `
    --remove Microsoft.VisualStudio.Component.Windows10SDK.14393 `
    --remove Microsoft.VisualStudio.Component.Windows81SDK `
 || IF "%ERRORLEVEL%"=="3010" EXIT 0

# 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"]

Build was extremelly fast, but no workloads were installed. Does any one know how to fix this problem?

Thanks in advance.

Upvotes: 3

Views: 6507

Answers (1)

nvu
nvu

Reputation: 157

I have found the problem. In the basic image mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019 was a newer version of visual studio build tools installed. When we try to install an older version of build tools on this basic image, it does not work.

Upvotes: 9

Related Questions