"C:\Microsoft.Cpp.Default.props" was not found
spacepirate0001 opened this issue · 1 comments
Describe the Bug
Using mcr.microsoft.com/dotnet/framework/sdk:4.8.1 AS build
Building the .sln returns the error!
RUN dotnet build *.sln -c Release -o /app/build
Trying to
# 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 /wait vs_buildtools.exe --installPath "%ProgramFiles(x86)%\Microsoft Visual Studio\2022\BuildTools" --quiet --wait --norestart --nocache --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended && \
del vs_buildtools.exe
does not add the Tools
I also tried adding Microsoft.VisualStudio.Workload.UniversalBuildTools but did not work either! https://learn.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-build-tools?view=vs-2022#windows-application-development-build-tools
Steps to Reproduce
# Use an official .NET SDK image as a parent image for Windows
FROM mcr.microsoft.com/dotnet/framework/sdk:4.8.1 AS build
RUN curl -sSL https://aka.ms/vs/17/release/vs_buildtools.exe -o vs_buildtools.exe && \
start /wait vs_buildtools.exe --installPath "%ProgramFiles(x86)%\Microsoft Visual Studio\2022\BuildTools" --quiet --wait --norestart --nocache --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended && \
del vs_buildtools.exe
RUN dotnet build *.sln -c Release -o /app/build
Other Information
error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the expression in the Import declaration "\Microsoft.Cpp.Default.props" is correct, and that the file exists on disk.
Output of 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
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: 2
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
Solved with:
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.UniversalBuildTools --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
Find the file
C:\>dir "C:\Program Files (x86)\*Microsoft.Cpp.Default.props*" /s
Found the file in
Directory of C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Microsoft\VC\v170
07/31/2024 06:37 PM 22,995 Microsoft.Cpp.Default.props
1 File(s) 22,995 bytes
Total Files Listed:
1 File(s) 22,995 bytes
0 Dir(s) 126,299,648,000 bytes free
Create a symbolic link for Microsoft.Cpp.Default.props
RUN mklink "C:\\Microsoft.Cpp.Default.props" "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\MSBuild\\Microsoft\\VC\\v170\\Microsoft.Cpp.Default.props"