【发布时间】:2022-10-06 19:00:41
【问题描述】:
在容器中安装 Windows Server 2022 和 Visual Studio 2022 时面临问题
我正在使用下面的 Dockerfile
# escape=`
# Use the latest Windows Server Core 2019 image.
FROM mcr.microsoft.com/windows/servercore:ltsc2022
# Restore the default Windows shell for correct batch processing.
SHELL [\"cmd\", \"/S\", \"/C\"]
RUN `
# Download the Build Tools bootstrapper.
curl -SL --output vs_enterprise.exe https://aka.ms/vs/17/release/vs_enterprise.exe `
`
# Install Build Tools with the Microsoft.VisualStudio.Workload.AzureBuildTools workload, excluding workloads and components with known issues.
&& (start /w vs_enterprise.exe --quiet --wait --norestart --nocache `
--installPath \"%ProgramFiles(x86)%\\Microsoft Visual Studio\\2022\\Enterprise\" `
--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) `
`
# Cleanup
&& del /q vs_enterprise.exe
# Define the entry point for the docker container.
# This entry point starts the developer command prompt and launches the PowerShell shell.
ENTRYPOINT [\"C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2022\\\\Enterprise\\\\Common7\\\\Tools\\\\VsDevCmd.bat\", \"&&\", \"powershell.exe\", \"-NoLogo\", \"-ExecutionPolicy\", \"Bypass\"]
安装后,当我尝试测试 webtest 时出现以下错误
MSTest: The term \'MSTest\' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + MSTest + ~~~~~~ + CategoryInfo : ObjectNotFound: (MSTest:String) [], >CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
标签: docker image visual-studio dockerfile containers