尝试将 Visual Studio 2019 构建工具安装到 Docker 映像中

nvu*_*nvu 2 continuous-integration build-tools visual-studio jenkins docker

I\xe2\x80\x99m 尝试将 Visual Studio Build Tools 2019(版本 16_4_5)安装到 Docker 中,但没有安装任何内容。

\n

我已按照 Microsoft 的说明(https://learn.microsoft.com/de-de/visualstudio/install/build-tools-container?view=vs-2019)使用以下构建文件

\n
# escape=`\n\n# Use the latest Windows Server Core image with .NET Framework 4.8.\nFROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019\n\n# Restore the default Windows shell for correct batch processing.\nSHELL ["cmd", "/S", "/C"]\n\n# Install build tools 16.4.5\nADD https://download.visualstudio.microsoft.com/download/pr/378e5eb4-c1d7-4c05-8f5f-55678a94e7f4/b9619acc0f9a1dfbdc1b67fddf9972e169916ceae237cf95f286c9e5547f804f/vs_BuildTools.exe C:\\TEMP\\vs_buildtools.exe\n\n# Install Build Tools with the Microsoft.VisualStudio.Workload.AzureBuildTools workload, excluding workloads and components with known issues.\nRUN C:\\TEMP\\vs_buildtools.exe --quiet --wait --norestart --nocache `\n    --installPath C:\\BuildTools `\n    --add Microsoft.VisualStudio.Workload.AzureBuildTools `\n    --remove Microsoft.VisualStudio.Component.Windows10SDK.10240 `\n    --remove Microsoft.VisualStudio.Component.Windows10SDK.10586 `\n    --remove Microsoft.VisualStudio.Component.Windows10SDK.14393 `\n    --remove Microsoft.VisualStudio.Component.Windows81SDK `\n || IF "%ERRORLEVEL%"=="3010" EXIT 0\n\n# Define the entry point for the docker container.\n# This entry point starts the developer command prompt and launches the PowerShell shell.\nENTRYPOINT ["C:\\\\BuildTools\\\\Common7\\\\Tools\\\\VsDevCmd.bat", "&&", "powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]\n
Run Code Online (Sandbox Code Playgroud)\n

构建速度非常快,但没有安装任何工作负载。有谁知道如何解决这个问题?

\n

提前致谢。

\n

nvu*_*nvu 8

我已经找到问题了。基本映像中mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019安装了较新版本的 Visual Studio 构建工具。当我们尝试在此基本映像上安装旧版本的构建工具时,它不起作用。