【问题标题】:Facing issue while installing windows server 2022 and visual studio 2022 into images can not able test MSTest将 Windows Server 2022 和 Visual Studio 2022 安装到图像中时面临的问题无法测试 MSTest
【发布时间】: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


    【解决方案1】:

    Microsoft 当前在 Visual Studio 安装程序后端存在问题。你可能会受到影响。见here

    摘要:VS Setup 当前已关闭

    【讨论】:

      【解决方案2】:

      尝试像这样运行它:

      FROM mcr.microsoft.com/windows/servercore:ltsc2019
      
      # Restore the default Windows shell for correct batch processing.
      SHELL ["cmd", "/S", "/C"]
      
      RUN curl -SL --output vs_buildtools.exe https://aka.ms/vs/17/release/vs_buildtools.exe \
          && (start /w vs_buildtools.exe --quiet --wait --norestart --nocache \
              --installPath "%ProgramFiles(x86)%\Microsoft Visual Studio\2022\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) \
          # Cleanup
          && del /q vs_buildtools.exe
      

      【讨论】:

        猜你喜欢
        • 2021-11-23
        • 2022-10-24
        • 2022-01-25
        • 2021-12-22
        • 2022-06-25
        • 2021-09-03
        • 2021-12-23
        • 2022-06-21
        • 2022-09-25
        相关资源
        最近更新 更多