是否可以在Windows容器中安装Visual Studio [英] Is it possible to install Visual Studio in a Windows Container
问题描述
是否可以在 Windows服务器上的Windows容器?
动机是使用Windows容器在持续集成系统中构建软件,从而使构建环境标准化.
The motivation is to use Windows Containers for building software in continuous integration systems, so that the build environment is standardized.
推荐答案
Visual Studio seems to not be supported officially on Core Server, but I agree it would be really nice to be able to do this. Let's try:
FROM mcr.microsoft.com/windows/servercore:ltsc2019
SHELL ["powershell"]
RUN Invoke-WebRequest "https://aka.ms/vs/16/release/vs_community.exe" -OutFile "$env:TEMP\vs_community.exe" -UseBasicParsing
RUN & "$env:TEMP\vs_community.exe" --add Microsoft.VisualStudio.Workload.NetWeb --quiet --wait --norestart --noUpdateInstaller | Out-Default
RUN & 'C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/MSBuild/15.0/Bin/MSBuild.exe' /version
CMD ["powershell"]
(我正在将此图像推送到 lukaslansky/visualstudio-netwebworkload ,请谨慎使用.)
(I'm pushing this image into lukaslansky/visualstudio-netwebworkload, use with caution.)
构建的输出为:
[...]
Microsoft (R) Build Engine version 15.3.409.57025 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
所以这似乎行得通!您应该使用那些--add
安装程序参数来指定构建所需的组件,它们与您在GUI中看到的工作负载和组件相对应. 请参阅文档.
So this seems to work! You should play with those --add
installator arguments to specify what components you need precisely for your build, they correspond to workloads and components you see in the GUI. See the documentation.
这篇关于是否可以在Windows容器中安装Visual Studio的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!