dotnet / core

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

.NET Core 3.0 Preview 9 Linux Container MsBuild Errors #3309

Closed olcayseker closed 5 years ago

olcayseker commented 5 years ago

Issue Title

.NET Core 3.0 Preview 9 Linux build errors (Win32Exception!)

General

dotnet build can not build console or classlib projects.

Host info:

OS Name:     ubuntu
OS Version:  18.04
OS Platform: Linux
RID:         ubuntu.18.04-x64

Steps to repro

1- docker run --rm -it --entrypoint="/bin/bash" mcr.microsoft.com/dotnet/core/sdk:3.0.100-preview9-bionic 2-

root@ff994da1d1db:/# cd root/ root@# mkdir console root@# cd console root@console# pwd /root/console root@/console# dotnet new console


Processing post-creation actions...
Running 'dotnet restore' on /root/console/console.csproj...
Restore completed in 47.77 ms for /root/console/console.csproj.

Restore succeeded.

root@/console# dotnet build

Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 11.78 ms for /root/console/console.csproj.
  You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview
/usr/share/dotnet/sdk/3.0.100-preview9-014004/Roslyn/Microsoft.CSharp.Core.targets(59,5): error MSB6004: The specified task executable location "/" is invalid. [/root/console/console.csproj]

Build FAILED.

/usr/share/dotnet/sdk/3.0.100-preview9-014004/Roslyn/Microsoft.CSharp.Core.targets(59,5): error MSB6004: The specified task executable location "/" is invalid. [/root/console/console.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.54

The error above is reprodicible with other Linux containers too. Lets try classlib if it is ridiculous to build an exe under Linux

root@# mkdir dll root@# cd dll root@/dll# dotnet new classlib


Processing post-creation actions...
Running 'dotnet restore' on /root/dll/dll.csproj...
  Restore completed in 4.03 sec for /root/dll/dll.csproj.

Restore succeeded.

root@/dll# dotnet build

Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 16.94 ms for /root/dll/dll.csproj.
  You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview
/usr/share/dotnet/sdk/3.0.100-preview8-013656/Roslyn/Microsoft.CSharp.Core.targets(59,5): error MSB6004: The specified task executable location "/" is invalid. [/root/dll/dll.csproj]

Build FAILED.

/usr/share/dotnet/sdk/3.0.100-preview8-013656/Roslyn/Microsoft.CSharp.Core.targets(59,5): error MSB6004: The specified task executable location "/" is invalid. [/root/dll/dll.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.55

root@/dll# dotnet publish -c Release -r linux-x64 -o out


Microsoft (R) Build Engine version 16.3.0-preview-19377-01+dd8019d9e for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

Restore completed in 82.39 ms for /root/dll/dll.csproj. You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview /usr/share/dotnet/sdk/3.0.100-preview8-013656/Roslyn/Microsoft.CSharp.Core.targets(59,5): error MSB6004: The specified task executable location "/" is invalid. [/root/dll/dll.csproj]


We have a .net core console app which outputs interesting (Win32Exception??) error after build. Removing `<OutputType>Exe</OutputType>` did not change the result.

>RUN dotnet build "My_Console_Project.csproj"

---> Running in 38eb6c8af43d Microsoft (R) Build Engine version 16.3.0-preview-19426-01+faf5e5d75 for .NET Core Copyright (C) Microsoft Corporation. All rights reserved.

Restore completed in 19.6 sec for /src/project1/My_Console_Project..csproj. Restore completed in 19.6 sec for /src/Entities/Mro.Entities.csproj. Restore completed in 19.6 sec for /src/Configuration/Domain/Domain.csproj. Restore completed in 19.6 sec for /src/Configuration/Infrastructure/Infrastructure.csproj.

Build succeeded. 0 Warning(s) 0 Error(s)

Time Elapsed 00:00:20.09 MSBUILD : error MSB1025: An internal failure occurred while running MSBuild. Microsoft.Build.BackEnd.NodeFailedToLaunchException: The FileName property should not be a directory unless UseShellExecute is set. ---> System.ComponentModel.Win32Exception (0x80004005): The FileName property should not be a directory unless UseShellExecute is set. at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo) at System.Diagnostics.Process.Start() at System.Diagnostics.Process.Start(ProcessStartInfo startInfo) at Microsoft.Build.BackEnd.NodeProviderOutOfProcBase.LaunchNode(String msbuildLocation, String commandLineArgs) --- End of inner exception stack trace --- at Microsoft.Build.BackEnd.NodeProviderOutOfProcBase.LaunchNode(String msbuildLocation, String commandLineArgs) at Microsoft.Build.BackEnd.NodeProviderOutOfProcBase.GetNode(String msbuildLocation, String commandLineArgs, Int32 nodeId, INodePacketFactory factory, Int64 hostHandshake, Int64 clientHandshake, NodeContextTerminateDelegate terminateNode) at Microsoft.Build.BackEnd.NodeProviderOutOfProc.CreateNode(Int32 nodeId, INodePacketFactory factory, NodeConfiguration configuration) at Microsoft.Build.BackEnd.NodeManager.AttemptCreateNode(INodeProvider nodeProvider, NodeConfiguration nodeConfiguration) at Microsoft.Build.BackEnd.NodeManager.CreateNode(NodeConfiguration configuration, NodeAffinity nodeAffinity) at Microsoft.Build.Execution.BuildManager.PerformSchedulingActions(IEnumerable1 responses) at Microsoft.Build.Execution.BuildManager.HandleNewRequest(Int32 node, BuildRequestBlocker blocker) at Microsoft.Build.Execution.BuildManager.ProcessPacket(Int32 node, INodePacket packet) at Microsoft.Build.Execution.BuildManager.<>c__DisplayClass67_0.<Microsoft.Build.BackEnd.INodePacketHandler.PacketReceived>b__0() at Microsoft.Build.Execution.BuildManager.ProcessWorkQueue(Action action) --- End of stack trace from previous location where exception was thrown --- at Microsoft.Build.Execution.BuildManager.EndBuild() at Microsoft.Build.CommandLine.MSBuildApp.BuildProject(String projectFile, String[] targets, String toolsVersion, Dictionary2 globalProperties, Dictionary2 restoreProperties, ILogger[] loggers, LoggerVerbosity verbosity, DistributedLoggerRecord[] distributedLoggerRecords, Int32 cpuCount, Boolean enableNodeReuse, TextWriter preprocessWriter, Boolean detailedSummary, ISet1 warningsAsErrors, ISet`1 warningsAsMessages, Boolean enableRestore, ProfilerLogger profilerLogger, Boolean enableProfiler, Boolean interactive, Boolean isolateProjects, Boolean graphBuild, String[] inputResultsCaches, String outputResultsCache)

MSBUILD : error MSB1025: An internal failure occurred while running MSBuild. Microsoft.Build.BackEnd.NodeFailedToLaunchException: The FileName property should not be a directory unless UseShellExecute is set. ---> System.ComponentModel.Win32Exception (0x80004005): The FileName property should not be a directory unless UseShellExecute is set. at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo) at System.Diagnostics.Process.Start() at System.Diagnostics.Process.Start(ProcessStartInfo startInfo) at Microsoft.Build.BackEnd.NodeProviderOutOfProcBase.LaunchNode(String msbuildLocation, String commandLineArgs) --- End of inner exception stack trace --- at Microsoft.Build.CommandLine.MSBuildApp.BuildProject(String projectFile, String[] targets, String toolsVersion, Dictionary2 globalProperties, Dictionary2 restoreProperties, ILogger[] loggers, LoggerVerbosity verbosity, DistributedLoggerRecord[] distributedLoggerRecords, Int32 cpuCount, Boolean enableNodeReuse, TextWriter preprocessWriter, Boolean detailedSummary, ISet1 warningsAsErrors, ISet1 warningsAsMessages, Boolean enableRestore, ProfilerLogger profilerLogger, Boolean enableProfiler, Boolean interactive, Boolean isolateProjects, Boolean graphBuild, String[] inputResultsCaches, String outputResultsCache) at Microsoft.Build.CommandLine.MSBuildApp.Execute(String[] commandLine) Unhandled exception. Microsoft.Build.BackEnd.NodeFailedToLaunchException: The FileName property should not be a directory unless UseShellExecute is set. ---> System.ComponentModel.Win32Exception (0x80004005): The FileName property should not be a directory unless UseShellExecute is set. at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo) at System.Diagnostics.Process.Start() at System.Diagnostics.Process.Start(ProcessStartInfo startInfo) at Microsoft.Build.BackEnd.NodeProviderOutOfProcBase.LaunchNode(String msbuildLocation, String commandLineArgs) --- End of inner exception stack trace --- at Microsoft.Build.CommandLine.MSBuildApp.BuildProject(String projectFile, String[] targets, String toolsVersion, Dictionary2 globalProperties, Dictionary2 restoreProperties, ILogger[] loggers, LoggerVerbosity verbosity, DistributedLoggerRecord[] distributedLoggerRecords, Int32 cpuCount, Boolean enableNodeReuse, TextWriter preprocessWriter, Boolean detailedSummary, ISet1 warningsAsErrors, ISet1 warningsAsMessages, Boolean enableRestore, ProfilerLogger profilerLogger, Boolean enableProfiler, Boolean interactive, Boolean isolateProjects, Boolean graphBuild, String[] inputResultsCaches, String outputResultsCache) at Microsoft.Build.CommandLine.MSBuildApp.Execute(String[] commandLine) at Microsoft.Build.CommandLine.MSBuildApp.Main(String[] args) ERROR: Service 'xxx' failed to build: The command '/bin/sh -c dotnet build "My_Console_Project..csproj"' returned a non-zero code: 134


I am not sure whether both errors related but i can not figure out what is wrong.
dasMulli commented 5 years ago

I thought i'd try to repro this since i'm trying to figure out a different build error but am unable to reproduce this on my machine (windows host with docker desktop)

C:\demos>docker run --rm -v c:/demos:/demos --entrypoint="/bin/bash" -it mcr.microsoft.com/dotnet/core/sdk:3.0.100-preview9-bionic
root@422bc2bf8c65:/# mkdir console                                                                                                                                      root@422bc2bf8c65:/# cd console/
root@422bc2bf8c65:/console# dotnet new console
Getting ready...
The template "Console Application" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on /console/console.csproj...
  Restore completed in 70.99 ms for /console/console.csproj.

Restore succeeded.

root@422bc2bf8c65:/console# dotnet build -bl
Microsoft (R) Build Engine version 16.3.0-preview-19426-01+faf5e5d75 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

/usr/share/dotnet/sdk/3.0.100-preview9-014004/MSBuild.dll -bl -consoleloggerparameters:Summary -distributedlogger:Microsoft.DotNet.Tools.MSBuild.MSBuild                usr/share/dotnet/sdk/3.0.100-preview9-014004/dotnet.dll*Microsoft.DotNet.Tools.MSBuild.MSBuildForwardingLogger,/usr/share/dotnet/sdk/3.0.100-preview9-01                net.dll -maxcpucount -restore -verbosity:m ./console.csproj
  Restore completed in 14.24 ms for /console/console.csproj.
  You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview
  console -> /console/bin/Debug/netcoreapp3.0/console.dll

Build succeeded.
    0 Warning(s)                                                                                                                                                            0 Error(s)

Time Elapsed 00:00:01.60
dasMulli commented 5 years ago

If you add -bl to the command, the build will generate an msbuild.binlog file that could give more detailed info about the failure (which is what i tried to get, but it didn't fail for me)

FernandoPucci commented 5 years ago

I'm facing exactly same problem with all tested dotnet 2.2 tagged docker images (e.g. mcr.microsoft.com/dotnet/core/sdk:2.2.401-bionic) since yesterday. I'd tried a lot of other dotnet core images also.

My production application stopped build with MSB1025 error.

MSBUILD : error MSB1025: An internal failure occurred while running MSBuild.
Microsoft.Build.BackEnd.NodeFailedToLaunchException: The FileName property should not be a directory unless UseShellExecute is set. ---> System.ComponentModel.Win32Exception: The FileName property should not be a directory unless UseShellExecute is set.
   at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
   at Microsoft.Build.BackEnd.NodeProviderOutOfProcBase.LaunchNode(String msbuildLocation, String commandLineArgs)
   --- End of inner exception stack trace ---
   at Microsoft.Build.BackEnd.NodeProviderOutOfProcBase.LaunchNode(String msbuildLocation, String commandLineArgs)
   at Microsoft.Build.BackEnd.NodeProviderOutOfProcBase.GetNode(String msbuildLocation, String commandLineArgs, Int32 nodeId, INodePacketFactory factory, Int64 hostHandshake, Int64 clientHandshake, NodeContextTerminateDelegate terminateNode)
   at Microsoft.Build.BackEnd.NodeProviderOutOfProc.CreateNode(Int32 nodeId, INodePacketFactory factory, NodeConfiguration configuration)
   at Microsoft.Build.BackEnd.NodeManager.AttemptCreateNode(INodeProvider nodeProvider, NodeConfiguration nodeConfiguration)
   at Microsoft.Build.BackEnd.NodeManager.CreateNode(NodeConfiguration configuration, NodeAffinity nodeAffinity)
   at Microsoft.Build.Execution.BuildManager.PerformSchedulingActions(IEnumerable`1 responses)
   at Microsoft.Build.Execution.BuildManager.HandleNewRequest(Int32 node, BuildRequestBlocker blocker)
   at Microsoft.Build.Execution.BuildManager.ProcessPacket(Int32 node, INodePacket packet)
   at Microsoft.Build.Execution.BuildManager.<>c__DisplayClass67_0.<Microsoft.Build.BackEnd.INodePacketHandler.PacketReceived>b__0()
   at Microsoft.Build.Execution.BuildManager.ProcessWorkQueue(Action action)
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.Build.Execution.BuildManager.EndBuild()
   at Microsoft.Build.CommandLine.MSBuildApp.BuildProject(String projectFile, String[] targets, String toolsVersion, Dictionary`2 globalProperties, Dictionary`2 restoreProperties, ILogger[] loggers, LoggerVerbosity verbosity, DistributedLoggerRecord[] distributedLoggerRecords, Int32 cpuCount, Boolean enableNodeReuse, TextWriter preprocessWriter, Boolean detailedSummary, ISet`1 warningsAsErrors, ISet`1 warningsAsMessages, Boolean enableRestore, ProfilerLogger profilerLogger, Boolean enableProfiler, Boolean interactive, Boolean isolateProjects, Boolean graphBuild, String[] inputResultsCaches, String outputResultsCache)

MSBUILD : error MSB1025: An internal failure occurred while running MSBuild.
Microsoft.Build.BackEnd.NodeFailedToLaunchException: The FileName property should not be a directory unless UseShellExecute is set. ---> System.ComponentModel.Win32Exception: The FileName property should not be a directory unless UseShellExecute is set.
   at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
   at Microsoft.Build.BackEnd.NodeProviderOutOfProcBase.LaunchNode(String msbuildLocation, String commandLineArgs)
   --- End of inner exception stack trace ---
   at Microsoft.Build.CommandLine.MSBuildApp.BuildProject(String projectFile, String[] targets, String toolsVersion, Dictionary`2 globalProperties, Dictionary`2 restoreProperties, ILogger[] loggers, LoggerVerbosity verbosity, DistributedLoggerRecord[] distributedLoggerRecords, Int32 cpuCount, Boolean enableNodeReuse, TextWriter preprocessWriter, Boolean detailedSummary, ISet`1 warningsAsErrors, ISet`1 warningsAsMessages, Boolean enableRestore, ProfilerLogger profilerLogger, Boolean enableProfiler, Boolean interactive, Boolean isolateProjects, Boolean graphBuild, String[] inputResultsCaches, String outputResultsCache)
   at Microsoft.Build.CommandLine.MSBuildApp.Execute(String[] commandLine)

Unhandled Exception: Microsoft.Build.BackEnd.NodeFailedToLaunchException: The FileName property should not be a directory unless UseShellExecute is set. ---> System.ComponentModel.Win32Exception: The FileName property should not be a directory unless UseShellExecute is set.
   at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
   at Microsoft.Build.BackEnd.NodeProviderOutOfProcBase.LaunchNode(String msbuildLocation, String commandLineArgs)
   --- End of inner exception stack trace ---
   at Microsoft.Build.CommandLine.MSBuildApp.BuildProject(String projectFile, String[] targets, String toolsVersion, Dictionary`2 globalProperties, Dictionary`2 restoreProperties, ILogger[] loggers, LoggerVerbosity verbosity, DistributedLoggerRecord[] distributedLoggerRecords, Int32 cpuCount, Boolean enableNodeReuse, TextWriter preprocessWriter, Boolean detailedSummary, ISet`1 warningsAsErrors, ISet`1 warningsAsMessages, Boolean enableRestore, ProfilerLogger profilerLogger, Boolean enableProfiler, Boolean interactive, Boolean isolateProjects, Boolean graphBuild, String[] inputResultsCaches, String outputResultsCache)
   at Microsoft.Build.CommandLine.MSBuildApp.Execute(String[] commandLine)
   at Microsoft.Build.CommandLine.MSBuildApp.Main(String[] args)

I also used the command RUN TERM=xterm dotnet build -bl ..... in my Dockerfile but no success.

olcayseker commented 5 years ago

I thought Docker was build to get rid of "works on my machine"? Anyways here is the result.

>docker run --rm  --entrypoint="/bin/bash" -it mcr.microsoft.com/dotnet/core/sdk:3.0.100-preview9-bionic 
root@479f77fc5208:/# cd root
root@479f77fc5208:~# mkdir console
root@479f77fc5208:~# cd console/
root@479f77fc5208:~/console# dotnet new console
Getting ready...
The template "Console Application" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on /root/console/console.csproj...
  Restore completed in 46.74 ms for /root/console/console.csproj.

Restore succeeded.

>root@479f77fc5208:~/console# dotnet build -bl
Microsoft (R) Build Engine version 16.3.0-preview-19426-01+faf5e5d75 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

/usr/share/dotnet/sdk/3.0.100-preview9-014004/MSBuild.dll -bl -consoleloggerparameters:Summary -distributedlogger:Microsoft.DotNet.Tools.MSBuild.MSBuildLogger,/usr/share/dotnet/sdk/3.0.100-preview9-014004/dotnet.dll*Microsoft.DotNet.Tools.MSBuild.MSBuildForwardingLogger,/usr/share/dotnet/sdk/3.0.100-preview9-014004/dotnet.dll -maxcpucount -restore -verbosity:m ./console.csproj
  Restore completed in 11.83 ms for /root/console/console.csproj.
  You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview
/usr/share/dotnet/sdk/3.0.100-preview9-014004/Roslyn/Microsoft.CSharp.Core.targets(59,5): error MSB6004: The specified task executable location "/" is invalid. [/root/console/console.csproj]

Build FAILED.

/usr/share/dotnet/sdk/3.0.100-preview9-014004/Roslyn/Microsoft.CSharp.Core.targets(59,5): error MSB6004: The specified task executable location "/" is invalid. [/root/console/console.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.58

Could it be something about Linux hosts? We are using same image but getting different output.

ps: forgot to add binlog file. msbuild.binlog.zip

FernandoPucci commented 5 years ago

FYI my local environment is Ubuntu 19

FernandoPucci commented 5 years ago

Strangely, but the same Dockerfile and project, in an Windows Host and Docker toolbox it's works!

dasMulli commented 5 years ago

could you fetch out the msbuild.binlog file from the container that was generated when built with the -bl switch? This file can be viewed with https://github.com/KirillOsenkov/MSBuildStructuredLog (or replayed to text logs) which can help in diagnosing the issue.. (i don't have linux host near me at the moment)

olcayseker commented 5 years ago

Sorry, attached already in previous comment. I will try to generate another binlog for Win32Exception.

dasMulli commented 5 years ago

@jcouv @rainersigwald @nguerrera do you have any idea why the CSC task would fail with MSB6004 on linux hosts only? AFAIK This should only happen when the Csc task is successfully loaded but then generates wrong paths..

dasMulli commented 5 years ago

Interestingly, docker environments seem to differ in the DOTNET_HOST_PATH environment variable wich is / on the failing containsers and /usr/share/dotnet/dotnet my one. But the build still works if i change it to /

FernandoPucci commented 5 years ago

Another interesting behavior, two of my projects which teams use windows machines and VS2019 had this issue.

In another particular project, always coded under Linux environment, the same image works fine.

olcayseker commented 5 years ago

Generated binlog file for Win32Exception under Linux was not contain any exception info. So i build our internal project with

dotnet build "mySolution.ConsoleProject1.csproj" -bl -c Release -o out -f netcoreapp3.0 -r linux-x64 -v d

and output file attached. Why MsBuild messing something that causes Win32Exception under Linux??

Microsoft.Build.BackEnd.NodeFailedToLaunchException: The FileName property should not be a directory unless UseShellExecute is set.
 ---> System.ComponentModel.Win32Exception (0x80004005): The FileName property should not be a directory unless UseShellExecute is set.
   at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)

output.zip

dasMulli commented 5 years ago

Win32Exception ist used for any error involving native methods, not just windows. It was not renamed for .NET core since it would have broken a lot of code.

rainersigwald commented 5 years ago

@dasMulli are you changing it inside or outside the dotnet build invocation? I believe that gets set in the CLI, and I think it being set and respected would explain this problem.

dasMulli commented 5 years ago

I was changing it outside, so that could explain it.. maybe csc trying to start vbcscompiler then causes this issue. Question is why this gets set to / on some hosts.

Could someone with this issue try it with -p:UseSharedCompilation=False?

qmfrederik commented 5 years ago

This started just started happening for me. I'm running Ubuntu 19.04 with kernel 5.0.0-27-generic. Was working perfectly fine until I upgraded a couple of packages and rebooted the system.

qmfrederik commented 5 years ago

Reverting to kernel 5.0.0-25-generic fixes the problem for me.

rainersigwald commented 5 years ago

Looping in @livarcocc, too.

The CLI passes DOTNET_HOST_PATH to MSBuild bsed on the value Process.GetCurrentProcess().MainModule.FileName. I have no idea why that would be reported incorrectly in some situations. I'm more inclined to suspect a .NET change than the kernel, but that's an interesting data point above . . .

igoventura commented 5 years ago

FYI in my MacOS with Docker v2.1.0.1 I didn't get this error. Here's the log:

root@5292389adda3:~# cd root/
bash: cd: root/: No such file or directory
root@5292389adda3:~# dir
root@5292389adda3:~# ls -a
.  ..  .bashrc  .dotnet  .nuget  .profile
root@5292389adda3:~# mkdir console
root@5292389adda3:~# cd console/
root@5292389adda3:~/console# pwd
/root/console
root@5292389adda3:~/console# dotnet new console
Getting ready...
The template "Console Application" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on /root/console/console.csproj...
  Restore completed in 97.49 ms for /root/console/console.csproj.

Restore succeeded.

root@5292389adda3:~/console# dotnet build
Microsoft (R) Build Engine version 16.3.0-preview-19426-01+faf5e5d75 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 20.56 ms for /root/console/console.csproj.
  You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview
  console -> /root/console/bin/Debug/netcoreapp3.0/console.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:02.27
root@5292389adda3:~/console# 

[edit 1] I used the same docker image: docker run --rm -it --entrypoint="/bin/bash" mcr.microsoft.com/dotnet/core/sdk:3.0.100-preview9-bionic

qmfrederik commented 5 years ago

@rainersigwald Have a look at https://stackoverflow.com/questions/57790510/msbuild-unhandled-exception-the-filename-property-should-not-be-a-directory-unl . Folks on that thread state the issue started in the last 24 hours, those able to resolve it did so by reverting their kernel. Further, reports the container works just fine on MacOS support the hypthesis that it's kernel-related.

FernandoPucci commented 5 years ago

In my case, downgrade to Kernlk 5.0.25 solved my problem! Now its work like a charm. Following the thread https://github.com/dotnet/core/issues/3312#issuecomment-528430791

dasMulli commented 5 years ago

I'd sugget to dupe against https://github.com/dotnet/core/issues/3312 and wait for coreclr/corefx to figure out why this happens, seems like the broken main module filename determination causes lots of different symptoms. (MSBuild not being able to start nodes, csc not being able to start vbcscompiler)

nguerrera commented 5 years ago

Duplicate of #3312

qmfrederik commented 5 years ago

There's a bug report over at Ubuntu Launchpad: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1843018 . You can upvote the bug report by clicking the "This bug affects me too" link just below the issue title.

mvarga6 commented 5 years ago

Adding an FYI here for reference because reverting to previous kernel fixed a seemingly unrelated issue I started encountering trying to attach to the vsdbg debugger in a .net core process in a container. In short, the debugger was never finding any PDB files to load symbols presumably due to Process.GetCurrentProcess().MainModule.FileName returning an incorrect value.

thangchung commented 5 years ago

Create the Ubuntu 18.04 LTS in Azure Portal, and we would get the error

root@lab01:/home/workshop/SimplAds# docker build -f  webapi/src/SimplAdsAPI/Dockerfile -t simpleadsapi:v1 .
Sending build context to Docker daemon  760.3kB
Step 1/16 : FROM mcr.microsoft.com/dotnet/core/sdk:3.0-buster AS build
 ---> 6b6086a5fb0e
Step 2/16 : WORKDIR /src
 ---> Using cache
 ---> e3abda56fe26
Step 3/16 : COPY ["/webapi/src/SimplAdsAPI/SimplAdsAPI.csproj", "src/SimplAdsAPI/"]
 ---> Using cache
 ---> 8e275fe1b5db
Step 4/16 : RUN dotnet restore "src/SimplAdsAPI/SimplAdsAPI.csproj"
 ---> Using cache
 ---> e90db442beca
Step 5/16 : COPY ["/webapi/src/SimplAdsAPI/.", "src/SimplAdsAPI/"]
 ---> Using cache
 ---> bb73baebd2b4
Step 6/16 : WORKDIR "/src/src/SimplAdsAPI"
 ---> Using cache
 ---> 1ac4c837412f
Step 7/16 : RUN dotnet build "SimplAdsAPI.csproj" -c Release -o /app/build --no-restore
 ---> Running in 6387090a2d03
Microsoft (R) Build Engine version 16.3.0-preview-19426-01+faf5e5d75 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview
/usr/share/dotnet/sdk/3.0.100-preview9-014004/Roslyn/Microsoft.CSharp.Core.targets(59,5): error MSB6004: The specified task executable location "/" is invalid. [/src/src/SimplAdsAPI/SimplAdsAPI.csproj]

Build FAILED.

/usr/share/dotnet/sdk/3.0.100-preview9-014004/Roslyn/Microsoft.CSharp.Core.targets(59,5): error MSB6004: The specified task executable location "/" is invalid. [/src/src/SimplAdsAPI/SimplAdsAPI.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:01.76
The command '/bin/sh -c dotnet build "SimplAdsAPI.csproj" -c Release -o /app/build --no-restore' returned a non-zero code: 1

I work-around it by upgrade the Ubuntu Kernel as below

$ sudo add-apt-repository ppa:teejee2008/ppa
$ sudo apt-get update
$ sudo apt-get install ukuu

Then I use ukuu to upgrade as following

Current Ubuntu Kernel version

root@lab01:/tmp# ukuu
ukuu v18.9.3
Distribution: Ubuntu 18.04.3 LTS
Architecture: amd64
Running kernel: 5.0.0-1018-azure
Kernel version: 5.0.0.19

List out all kernels and upgrade it

$ sudo ukuu --list
$ sudo ukuu --install v5.0.21

Then run the docker build again

root@lab01:/home/workshop/SimplAds# docker build -f  webapi/src/SimplAdsAPI/Dockerfile -t simpleadsapi:v1 .
Sending build context to Docker daemon  760.3kB
Step 1/16 : FROM mcr.microsoft.com/dotnet/core/sdk:3.0-buster AS build
 ---> 6b6086a5fb0e
Step 2/16 : WORKDIR /src
 ---> Using cache
 ---> e3abda56fe26
Step 3/16 : COPY ["/webapi/src/SimplAdsAPI/SimplAdsAPI.csproj", "src/SimplAdsAPI/"]
 ---> Using cache
 ---> 8e275fe1b5db
Step 4/16 : RUN dotnet restore "src/SimplAdsAPI/SimplAdsAPI.csproj"
 ---> Using cache
 ---> e90db442beca
Step 5/16 : COPY ["/webapi/src/SimplAdsAPI/.", "src/SimplAdsAPI/"]
 ---> Using cache
 ---> bb73baebd2b4
Step 6/16 : WORKDIR "/src/src/SimplAdsAPI"
 ---> Using cache
 ---> 1ac4c837412f
Step 7/16 : RUN dotnet build "SimplAdsAPI.csproj" -c Release -o /app/build --no-restore
 ---> Running in e29c0d7fa6b4
Microsoft (R) Build Engine version 16.3.0-preview-19426-01+faf5e5d75 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview
  SimplAdsAPI -> /app/build/SimplAdsAPI.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:05.42
Removing intermediate container e29c0d7fa6b4
 ---> 8cd3b5029dce
Step 8/16 : FROM build AS publish
 ---> 8cd3b5029dce
Step 9/16 : RUN dotnet publish "SimplAdsAPI.csproj" -c Release -o /app/publish --no-restore
 ---> Running in eb248ec54c9f
Microsoft (R) Build Engine version 16.3.0-preview-19426-01+faf5e5d75 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview
  SimplAdsAPI -> /src/src/SimplAdsAPI/bin/Release/netcoreapp3.0/SimplAdsAPI.dll
  SimplAdsAPI -> /app/publish/
Removing intermediate container eb248ec54c9f
 ---> 9e3e249a515f
Step 10/16 : FROM mcr.microsoft.com/dotnet/core/aspnet:3.0-buster-slim AS final
3.0-buster-slim: Pulling from dotnet/core/aspnet
1ab2bdfe9778: Already exists
6719d95d5b26: Pull complete
d84fcef13e65: Pull complete
c0a615c59dab: Pull complete
48ef12583529: Pull complete
Digest: sha256:74f6eab6e1a190e99f50fd22aa849623e54ce3c06b9425c281e75ca92fe7f74b
Status: Downloaded newer image for mcr.microsoft.com/dotnet/core/aspnet:3.0-buster-slim
 ---> ae6b2b9380c1
Step 11/16 : WORKDIR /app
 ---> Running in f7b4de6b6a03
Removing intermediate container f7b4de6b6a03
 ---> e44db3c2c220
Step 12/16 : ENV ASPNETCORE_URLS http://*:80
 ---> Running in 1216e5d73588
Removing intermediate container 1216e5d73588
 ---> 8f984d2a3f90
Step 13/16 : COPY --from=publish /app/publish .
 ---> f17e7342b37a
Step 14/16 : EXPOSE 80
 ---> Running in 29ca83c00e45
Removing intermediate container 29ca83c00e45
 ---> ba439a83fcbf
Step 15/16 : EXPOSE 443
 ---> Running in c518b711d134
Removing intermediate container c518b711d134
 ---> 3e5fa1d82904
Step 16/16 : ENTRYPOINT ["dotnet", "SimplAdsAPI.dll"]
 ---> Running in ebf9f1a2aad2
Removing intermediate container ebf9f1a2aad2
 ---> 05340b5090ba
Successfully built 05340b5090ba
Successfully tagged simpleadsapi:v1

Hope this help

ossentoo commented 5 years ago

Create the Ubuntu 18.04 LTS in Azure Portal, and we would get the error

root@lab01:/home/workshop/SimplAds# docker build -f  webapi/src/SimplAdsAPI/Dockerfile -t simpleadsapi:v1 .
Sending build context to Docker daemon  760.3kB
Step 1/16 : FROM mcr.microsoft.com/dotnet/core/sdk:3.0-buster AS build
 ---> 6b6086a5fb0e
Step 2/16 : WORKDIR /src
 ---> Using cache
 ---> e3abda56fe26
Step 3/16 : COPY ["/webapi/src/SimplAdsAPI/SimplAdsAPI.csproj", "src/SimplAdsAPI/"]
 ---> Using cache
 ---> 8e275fe1b5db
Step 4/16 : RUN dotnet restore "src/SimplAdsAPI/SimplAdsAPI.csproj"
 ---> Using cache
 ---> e90db442beca
Step 5/16 : COPY ["/webapi/src/SimplAdsAPI/.", "src/SimplAdsAPI/"]
 ---> Using cache
 ---> bb73baebd2b4
Step 6/16 : WORKDIR "/src/src/SimplAdsAPI"
 ---> Using cache
 ---> 1ac4c837412f
Step 7/16 : RUN dotnet build "SimplAdsAPI.csproj" -c Release -o /app/build --no-restore
 ---> Running in 6387090a2d03
Microsoft (R) Build Engine version 16.3.0-preview-19426-01+faf5e5d75 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview
/usr/share/dotnet/sdk/3.0.100-preview9-014004/Roslyn/Microsoft.CSharp.Core.targets(59,5): error MSB6004: The specified task executable location "/" is invalid. [/src/src/SimplAdsAPI/SimplAdsAPI.csproj]

Build FAILED.

/usr/share/dotnet/sdk/3.0.100-preview9-014004/Roslyn/Microsoft.CSharp.Core.targets(59,5): error MSB6004: The specified task executable location "/" is invalid. [/src/src/SimplAdsAPI/SimplAdsAPI.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:01.76
The command '/bin/sh -c dotnet build "SimplAdsAPI.csproj" -c Release -o /app/build --no-restore' returned a non-zero code: 1

I work-around it by upgrade the Ubuntu Kernel as below

$ sudo add-apt-repository ppa:teejee2008/ppa
$ sudo apt-get update
$ sudo apt-get install ukuu

Then I use ukuu to upgrade as following

Current Ubuntu Kernel version

root@lab01:/tmp# ukuu
ukuu v18.9.3
Distribution: Ubuntu 18.04.3 LTS
Architecture: amd64
Running kernel: 5.0.0-1018-azure
Kernel version: 5.0.0.19

List out all kernels and upgrade it

$ sudo ukuu --list
$ sudo ukuu --install v5.0.21

Then run the docker build again

root@lab01:/home/workshop/SimplAds# docker build -f  webapi/src/SimplAdsAPI/Dockerfile -t simpleadsapi:v1 .
Sending build context to Docker daemon  760.3kB
Step 1/16 : FROM mcr.microsoft.com/dotnet/core/sdk:3.0-buster AS build
 ---> 6b6086a5fb0e
Step 2/16 : WORKDIR /src
 ---> Using cache
 ---> e3abda56fe26
Step 3/16 : COPY ["/webapi/src/SimplAdsAPI/SimplAdsAPI.csproj", "src/SimplAdsAPI/"]
 ---> Using cache
 ---> 8e275fe1b5db
Step 4/16 : RUN dotnet restore "src/SimplAdsAPI/SimplAdsAPI.csproj"
 ---> Using cache
 ---> e90db442beca
Step 5/16 : COPY ["/webapi/src/SimplAdsAPI/.", "src/SimplAdsAPI/"]
 ---> Using cache
 ---> bb73baebd2b4
Step 6/16 : WORKDIR "/src/src/SimplAdsAPI"
 ---> Using cache
 ---> 1ac4c837412f
Step 7/16 : RUN dotnet build "SimplAdsAPI.csproj" -c Release -o /app/build --no-restore
 ---> Running in e29c0d7fa6b4
Microsoft (R) Build Engine version 16.3.0-preview-19426-01+faf5e5d75 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview
  SimplAdsAPI -> /app/build/SimplAdsAPI.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:05.42
Removing intermediate container e29c0d7fa6b4
 ---> 8cd3b5029dce
Step 8/16 : FROM build AS publish
 ---> 8cd3b5029dce
Step 9/16 : RUN dotnet publish "SimplAdsAPI.csproj" -c Release -o /app/publish --no-restore
 ---> Running in eb248ec54c9f
Microsoft (R) Build Engine version 16.3.0-preview-19426-01+faf5e5d75 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview
  SimplAdsAPI -> /src/src/SimplAdsAPI/bin/Release/netcoreapp3.0/SimplAdsAPI.dll
  SimplAdsAPI -> /app/publish/
Removing intermediate container eb248ec54c9f
 ---> 9e3e249a515f
Step 10/16 : FROM mcr.microsoft.com/dotnet/core/aspnet:3.0-buster-slim AS final
3.0-buster-slim: Pulling from dotnet/core/aspnet
1ab2bdfe9778: Already exists
6719d95d5b26: Pull complete
d84fcef13e65: Pull complete
c0a615c59dab: Pull complete
48ef12583529: Pull complete
Digest: sha256:74f6eab6e1a190e99f50fd22aa849623e54ce3c06b9425c281e75ca92fe7f74b
Status: Downloaded newer image for mcr.microsoft.com/dotnet/core/aspnet:3.0-buster-slim
 ---> ae6b2b9380c1
Step 11/16 : WORKDIR /app
 ---> Running in f7b4de6b6a03
Removing intermediate container f7b4de6b6a03
 ---> e44db3c2c220
Step 12/16 : ENV ASPNETCORE_URLS http://*:80
 ---> Running in 1216e5d73588
Removing intermediate container 1216e5d73588
 ---> 8f984d2a3f90
Step 13/16 : COPY --from=publish /app/publish .
 ---> f17e7342b37a
Step 14/16 : EXPOSE 80
 ---> Running in 29ca83c00e45
Removing intermediate container 29ca83c00e45
 ---> ba439a83fcbf
Step 15/16 : EXPOSE 443
 ---> Running in c518b711d134
Removing intermediate container c518b711d134
 ---> 3e5fa1d82904
Step 16/16 : ENTRYPOINT ["dotnet", "SimplAdsAPI.dll"]
 ---> Running in ebf9f1a2aad2
Removing intermediate container ebf9f1a2aad2
 ---> 05340b5090ba
Successfully built 05340b5090ba
Successfully tagged simpleadsapi:v1

Hope this help

this work around works for me 👍

bdaniel7 commented 5 years ago

I'm trying to build a asp.net 2.2, on a 5.0.0-1020-azure #21~18.04.1-Ubuntu. And I get the exception (NodeFailedToLaunchException: The FileName property should not be a directory unless UseShellExecute is set.)

I intalled ukuu:

ukuu v18.9.3 Distribution: Ubuntu 18.04.3 LTS Architecture: amd64 Running kernel: 5.0.0-1020-azure Kernel version: 5.0.0.21

And I still get the exception (NodeFailedToLaunchException: The FileName property should not be a directory unless UseShellExecute is set.)

Then I updated the kernel to 5.1.21 and the exception didn't occur anymore.

gabpalves commented 5 years ago

Similar problems here. Using ubuntu 18.04, kernel v5.0.0.29, fresh install, fully updated: "NodeFailedToLaunchException" errors happening at every docker build run. Same Dockerfile works on various other computers, from Debian to Windows to MacOS.

After installing the latest kernel version (5.3.1), released just hours ago, the issue disappeared.

ziphrax commented 5 years ago

I was having the same error on Ubuntu 19.04. The kernel update to 5.3.1 also fixed my problem

clarity99 commented 5 years ago

it's affecting building with github actions as well. Can't upgrade their kernel on my own ;)

Mercurial commented 5 years ago

same problem, updating kernel worked as suggested, thanks guys!

laurentkempe commented 5 years ago

it's affecting building with github actions as well. Can't upgrade their kernel on my own ;)

To make it work with github action, you can use

runs-on: ubuntu-16.04

in place of

runs-on: ubuntu-latest