dotnet / core

.NET news, announcements, release notes, and more!
https://dot.net
MIT License
20.71k stars 4.86k forks source link

/usr/share/dotnet/sdk/6.0.202/Roslyn/Microsoft.CSharp.Core.targets(75,5) #7434

Open paul-cheung opened 2 years ago

paul-cheung commented 2 years ago

I am using the gitpod to build my project on github, the workspace image based on Ubuntu 20.04.
Dotfiles i am using to install the dotnet sdk was like: install dotnet sdk

Now it failed to build gitpod /workspace/myproject (main) > dotnet build /usr/share/dotnet/sdk/6.0.202/Roslyn/Microsoft.CSharp.Core.targets(75,5): error MSB6004: The specified task executable location "/run/containerd/io.containerd.runtime.v2.task/k8s.io/cb2b4159045b836c6bc7e28d0e8b48a396ada2dc020f01599bce0eb0f55d6d6a/rootfs/usr/share/dotnet/dotnet" is invalid. [/workspace/myproject/src/Common/myproject.Common.csproj]

I have tried the solution mentioned here, but it did not help

For some reasons, I did NOT want to add .gitpod.yml file in my repository like this (workspace-dotnet base image which was specified in .gitpod.yml)

zlzforever commented 1 year ago

Maybe the issue cause by mount image files. There is a workaround:

image

image

I don't know why in the repo folder execute dotnet command, then used "/rootfs/usr/share/dotnet/dotnet".

Follow this, i build a new image and it works

` FROM mcr.microsoft.com/dotnet/sdk:6.0

RUN ln -s / /rootfs `

bmartin5263 commented 1 year ago

@zlzforever Thank you, this fixed my issue where I have been trying to run dotnet test within a Concourse task using the image mcr.microsoft.com/dotnet/sdk. It kept failing with the following error:

Failed to launch testhost with error: System.IO.FileNotFoundException: Path does not exist: /rootfs/usr/share/dotnet/dotnet (http://localhost:8080/#L647440ac:9)
File name: '/rootfs/usr/share/dotnet/dotnet'

Adding the following worked perfectly.

mkdir -p /rootfs/usr/share/dotnet
ln -s /usr/share/dotnet/dotnet /rootfs/usr/share/dotnet
dotnet test

Sharing in case anyone else out there searching for a fix for that error message may come across this.