Skip to content

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

@olcayseker

Description

@olcayseker

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(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 (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, 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 (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, 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)
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions