microsoft / Windows-Containers

Welcome to our Windows Containers GitHub community! Ask questions, report bugs, and suggest features -- let's work together.
MIT License
414 stars 64 forks source link

Cannot install Visual Studio inside a server core image #540

Open zillemarco opened 1 week ago

zillemarco commented 1 week ago

Describe the bug I am trying to install VS 2022 build tools inside of a docker container to build an image and use it for our CI builds. I already had an image working, but now I needed to update a dependency so I had to rebuild it (TL; DR: it worked last time I built it).

However, the installation now fails with error code 1603.

I have extracted the VS installation logs from the container and the main issue seems to be this:

Error Information
AppInsightsEvent Name = vs/setupengine/packagefailure
          Description = The Windows Installer Service could not be accessed. This can occur if the Windows Installer is not correctly installed. Contact your support personnel for assistance.
     TelemetrySession = 'aa0725d0-d978-4bf5-bd3c-8f68d3d9702f' Started = True OptIn=True IsInitialized = False Cloned = True
      WatsonEventType = VisualStudioNonFatalErrors2
             UTC time = 2024-09-26T12:17:52

I run an sfc /scannow inside brand new container using the image and it did find some corrupted files, so maybe the image itself has issues?

To Reproduce You should be able to reproduce this by building the following Dockerfile (based on the example here, where you can also find the Install.cmd file contents):

# escape=`

# Use the Windows Server Core as base image
FROM mcr.microsoft.com/windows/servercore:ltsc2019

SHELL ["cmd", "/S", "/C"]

COPY Install.cmd C:\TEMP\

ADD https://aka.ms/vscollect.exe C:\TEMP\collect.exe
ADD https://aka.ms/vs/17/release/channel C:\TEMP\VisualStudio.chman

RUN curl -SL --output vs_buildtools.exe https://aka.ms/vs/17/release/vs_buildtools.exe `
     && (call C:\TEMP\Install.cmd vs_buildtools.exe --quiet --wait --norestart --nocache install `
         --installPath "%ProgramFiles(x86)%\Microsoft Visual Studio\2022\BuildTools" `
         --channelUri C:\TEMP\VisualStudio.chman `
         --installChannelUri C:\TEMP\VisualStudio.chman `
         --add Microsoft.VisualStudio.Workload.MSBuildTools `
         --add Microsoft.VisualStudio.Workload.ManagedDesktopBuildTools `
         --add Microsoft.VisualStudio.Workload.VCTools `
         --add Microsoft.VisualStudio.Component.Windows11SDK.22000 `
         --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 `
         --add Microsoft.VisualStudio.Component.VC.ATLMFC) `
     && del /q vs_buildtools.exe

ENTRYPOINT ["C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\Common7\\Tools\\VsDevCmd.bat", "&&", "powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]

Expected behavior The image builds without issues.

Configuration:

github-actions[bot] commented 1 week ago

Thank you for creating an Issue. Please note that GitHub is not an official channel for Microsoft support requests. To create an official support request, please open a ticket here. Microsoft and the GitHub Community strive to provide a best effort in answering questions and supporting Issues on GitHub.

ntrappe-msft commented 3 days ago

@zillemarco Hey, thanks for bringing up this Issue. Have you tried to use a recent Windows Server Core LTSC 2022 image? Or only the 2019 version? I ask because we don't provide support for 2019 anymore.

zillemarco commented 3 days ago

Hi @ntrappe-msft, I did not because I don't have any server running win2022 and docker, and it wouldn't be a solution anyway because the server the image I'm trying to build is running win2019 unfortunately.

I also tried installing other software in the image, just to make sure it wasn't only related to Visual Studio, but anything I try to install it fail.

Moreover, the last image for ltsc2019 was built and published less than a month ago, so isn't it still kinda supported?