microsoft / dotnet-framework-docker

The repo for the official docker images for .NET Framework on Windows Server Core.
https://hub.docker.com/_/microsoft-dotnet-framework
MIT License
698 stars 334 forks source link

Unable to add any workloads/components #1027

Closed fabiang closed 1 year ago

fabiang commented 1 year ago

Hi,

I'm trying to add workloads and components into one of these images.

# escape=`

ARG BASE_IMAGE=servercore
ARG BASE_IMAGE_VERSION=ltsc2019
ARG DOTNET_VERSION=4.8

FROM mcr.microsoft.com/dotnet/framework/sdk:${DOTNET_VERSION}-windows${BASE_IMAGE}-${BASE_IMAGE_VERSION}

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

ARG VC_TOOLS_VERSION_MAJOR=17
ARG VS_TOOLS_VERSION_YEAR=2022

RUN setx BUILD_TOOLS_INSTALL_PATH "%ProgramFiles(x86)%\Microsoft Visual Studio\%VS_TOOLS_VERSION_YEAR%\BuildTools\\" /m

RUN curl -fSLo vs_BuildTools.exe https://aka.ms/vs/%VC_TOOLS_VERSION_MAJOR%/release/vs_BuildTools.exe

ADD https://aka.ms/vs/${VC_TOOLS_VERSION_MAJOR}/release/channel C:\\VisualStudio.chman

RUN start /w vs_BuildTools --quiet --wait --norestart --nocache `
    --channelUri c:\VisualStudio.chman `
    --installChannelUri c:\VisualStudio.chman `
    --installPath "%BUILD_TOOLS_INSTALL_PATH%" `
    --add Microsoft.VisualStudio.Workload.VCTools `
    --includeRecommended `
    && powershell -Command "if ($err = dir $Env:TEMP -Filter dd_setup_*_errors.log | where Length -gt 0 | Get-Content) { throw $err }"

The command executed successfully and there is no error log written in %TMP%. But when I look into any of the dd_installer_*.log I can see the following error:

[0280:0008][2022-11-21T15:38:05] Warning: Command line errors:
Option 'env' is unknown.
[0280:0001][2022-11-21T15:38:05] Warning: Failed to parse the command line arguments: Option 'env' is unknown. Usage: setup.exe install [options]

So is the file "%ProgramFiles(x86)%\Microsoft Visual Studio\installer\setup.exe" outdated or in the wrong version?

Output of setup.exe --version

Visual Studio Installer 2.11.69

Output of docker version

Client:
 Version:           20.10.21
 API version:       1.41
 Go version:        go1.18.7
 Git commit:        baeda1f82a
 Built:             Thu Oct 27 18:47:12 2022
 OS/Arch:           windows/amd64
 Context:           default
 Experimental:      true

Server:
 Engine:
  Version:          20.10.21
  API version:      1.41 (minimum version 1.24)
  Go version:       go1.18.7
  Git commit:       3056208812
  Built:            Thu Oct 27 18:45:35 2022
  OS/Arch:          windows/amd64
  Experimental:     false

Output of docker info

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.9.1)
  compose: Docker Compose (Docker Inc., v2.10.2)
  extension: Manages Docker extensions (Docker Inc., v0.2.9)
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0)
  scan: Docker Scan (Docker Inc., v0.19.0)

Server:
 Containers: 11
  Running: 1
  Paused: 0
  Stopped: 10
 Images: 461
 Server Version: 20.10.21
 Storage Driver: windowsfilter
  Windows:
 Logging Driver: json-file
 Plugins:
  Volume: local
  Network: ics internal l2bridge l2tunnel nat null overlay private transparent
  Log: awslogs etwlogs fluentd gcplogs gelf json-file local logentries splunk syslog
 Swarm: inactive
 Default Isolation: hyperv
 Kernel Version: 10.0 19045 (19041.1.amd64fre.vb_release.191206-1406)
 Operating System: Windows 10 Pro Version 2009 (OS Build 19045.2251)
 OSType: windows
 Architecture: x86_64
 CPUs: 4
 Total Memory: 15.87GiB
 Name: xxxxxx
 ID: xxxxxx
 Docker Root Dir: D:\docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false