visual-studio - 尝试将 Visual Studio 2019 构建工具安装到 Docker 镜像中

标签 visual-studio docker jenkins continuous-integration build-tools

我正在尝试将 Visual Studio Build Tools 2019(版本 16_4_5)安装到 Docker 中,但没有安装任何东西。

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

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

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

提前致谢。

最佳答案

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

关于visual-studio - 尝试将 Visual Studio 2019 构建工具安装到 Docker 镜像中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63523798/

相关文章:

xcode - Jenkins 配置文件问题

c# - 无法为 netstandard1.x 项目安装 Netstandard1.x Nuget 包

visual-studio - msbuild 任务通过发布配置文件来删除特定文件

visual-studio - 如何使用 std::string 创建条件断点

java - OpenJDK9 (Docker), gradle 4.2.1, GitLab

docker - 从什么时候将用户添加到 docker 组不足以执行 docker 客户端,我每次都需要 `newgrp docker`?

c# - Zillow 的 SearchResults.xsd 和 Visual Studio 的 XSD 命令

laravel - Docker Nginx PHP Laravel curl 无法连接到 api.localhost 端口 80。连接被拒绝

github - 如何使用 Jenkins 配置 SonarQube GitHub 插件

docker - Jenkins 管道无法终止 docker 容器