Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 533
nvu Avatar asked Oct 17 '25 15:10

nvu


1 Answers

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.

like image 56
nvu Avatar answered Oct 19 '25 11:10

nvu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!