版本
问题
我正在 docker 中运行一个 ASP.NET Core 项目。当我 docker-compose up 时,我得到以下信息:
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)
at Microsoft.Build.CommandLine.MSBuildApp.Execute(String[] commandLine)
at Microsoft.Build.CommandLine.MSBuildApp.Main(String[] args)
当它命中 dockerfile 中的 dotnet restore 行时,似乎会发生错误。
检查权限后,似乎docker对直接涉及的所有文件/文件夹都有读/写权限
今天早上有一些更新,这篇文章中的其他人也说他们也有。它们是否是相同的更新是未知的。但是有一些更新。 Here is my update log from the morning that this all started happening .
我的 Dockerfile 是这样的:
FROM microsoft/dotnet:2.1.403-sdk as dotnet
WORKDIR /vsdbg
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
unzip \
&& rm -rf /var/lib/apt/lists/* \
&& curl -sSL https://aka.ms/getvsdbgsh | bash /dev/stdin -v latest -l /vsdbg
WORKDIR /ProjA
# Install TRX -> JUnit log file converter
# https://github.com/gfoidl/trx2junit
RUN dotnet tool install -g trx2junit
RUN export PATH="$PATH:/root/.dotnet/tools"
COPY ProjA.sln .
COPY ProjA/ProjA.csproj ./ProjA/
COPY ProjA.Tests/ProjA.Tests.csproj ./ProjA.Tests/
COPY ProjB/ProjB.csproj ./ProjB/
COPY ProjC/ProjC.csproj ./ProjC/
RUN mkdir ProjA.Tests/tmp
RUN dotnet restore # ******* Error seems to happen here...
COPY . .
WORKDIR /ProjA/ProjA/
CMD ["dotnet", "run"]
最佳答案
我们在 Azure 上运行 Ubuntu 18.04 作为我们的 Docker 主机。 Azure 最近推出了内核版本 5.0.0-1018,这导致我们的 Linux 容器出现问题。降级到内核版本 4.18.0-1025 为我们修复了它。
关于c# - MSBuild 未处理的异常 : The FileName property should not be a directory unless UseShellExecute is set,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57790510/