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
714 stars 335 forks source link

error MSB8020: The build tools for v143 (Platform Toolset = 'v143') cannot be found. #1152

Closed spacepirate0001 closed 3 months ago

spacepirate0001 commented 3 months ago

Describe the Bug

FROM mcr.microsoft.com/dotnet/framework/sdk:4.8.1 AS build

# Install Visual Studio Build Tools with the required components
RUN curl -sSL https://aka.ms/vs/17/release/vs_buildtools.exe -o vs_buildtools.exe && \
    start /w vs_BuildTools modify --installPath "%ProgramFiles(x86)%\Microsoft Visual Studio\2022\BuildTools" --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended --quiet --norestart --nocache --wait && \
    powershell -Command "if ($err = dir $Env:TEMP -Filter dd_setup_*_errors.log | where Length -gt 0 | Get-Content) { throw $err }" && \
    del vs_buildtools.exe
# Copy all project files    
COPY . .

# Restore the solution packages
RUN nuget restore Recorder.Complete.sln

# Build the solution
RUN dotnet build *.sln -c Release -o /app/build
The build tools for v143 (Platform Toolset = 'v143') cannot be found. To build using the v143 build tools, please install v143 build tools.  Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project me 
nu or right-click the solution, and then selecting "Retarget solution".

Steps to Reproduce

Other Information

Output of docker version

docker version
Client:
 Version:           27.1.1
 API version:       1.46
 Go version:        go1.21.12
 Git commit:        6312585
 Built:             Tue Jul 23 19:57:57 2024
 OS/Arch:           windows/amd64
 Context:           desktop-windows

Server: Docker Desktop 4.33.0 (160616)
 Engine:
  Version:          27.1.1
  API version:      1.46 (minimum version 1.24)
  Go version:       go1.21.12
  Git commit:       cc13f95
  Built:            Tue Jul 23 19:56:46 2024
  OS/Arch:          windows/amd64
  Experimental:     false

Output of docker info

docker info
Client:
 Version:    27.1.1
 Context:    desktop-windows
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.16.1-desktop.1
    Path:     C:\Program Files\Docker\cli-plugins\docker-buildx.exe
  compose: Docker Compose (Docker Inc.)
    Version:  v2.29.1-desktop.1
    Path:     C:\Program Files\Docker\cli-plugins\docker-compose.exe
  debug: Get a shell into any image or container (Docker Inc.)
    Version:  0.0.34
    Path:     C:\Program Files\Docker\cli-plugins\docker-debug.exe
  desktop: Docker Desktop commands (Alpha) (Docker Inc.)
    Version:  v0.0.14
    Path:     C:\Program Files\Docker\cli-plugins\docker-desktop.exe
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.2
    Path:     C:\Program Files\Docker\cli-plugins\docker-dev.exe
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.25
    Path:     C:\Program Files\Docker\cli-plugins\docker-extension.exe
  feedback: Provide feedback, right in your terminal! (Docker Inc.)
    Version:  v1.0.5
    Path:     C:\Program Files\Docker\cli-plugins\docker-feedback.exe
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v1.3.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-init.exe
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-sbom.exe
  scout: Docker Scout (Docker Inc.)
    Version:  v1.11.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-scout.exe

Server:
 Containers: 1
  Running: 0
  Paused: 0
  Stopped: 1
 Images: 13
 Server Version: 27.1.1
 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 splunk syslog
 Swarm: inactive
 Default Isolation: hyperv
 Kernel Version: 10.0 22631 (22621.1.amd64fre.ni_release.220506-1250)
 Operating System: Microsoft Windows Version 23H2 (OS Build 22631.3880)
 OSType: windows
 Architecture: x86_64
 CPUs: 8
 Total Memory: 15.65GiB
 Name: loop3166
 ID: ded99793-7704-44ba-b94f-1f2342f3e233
 Docker Root Dir: C:\ProgramData\Docker
 Debug Mode: false
 Labels:
  com.docker.desktop.address=npipe://\\.\pipe\docker_cli
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine
richlander commented 3 months ago

Does this work on your local machine using commandline build?

spacepirate0001 commented 3 months ago

I had it built using Visual Studio! Now trying to replicate via docker but unable to.

lbussell commented 3 months ago

@spacepirate0001, are you trying to build a Visual C++ app since you're installing Microsoft.VisualStudio.Workload.VCTools?

richlander commented 3 months ago

Going from VS to Docker is too large a jump. You need to validate building this project from the commandline on your local machine.

lbussell commented 3 months ago

[Triage] Closing since there isn't enough information to determine if there's an issue with the images. @spacepirate0001 feel free to open if you have more info to help us troubleshoot.