You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(Side note: the path suggests NUnit, but the reference was removed, as that's not the root of the issue at all.)
Now the build process:
FROM mcr.microsoft.com/dotnet/core/sdk:5.0-buster
COPY . .
RUN dotnet test NUnitTestProject1/NUnitTestProject1.csproj
RUN dotnet build -c Release -o /app/build
The build will fail on the last command. The error log is:
2020-09-03T08:00:50.5307809Z Step 4/4 : RUN dotnet build -c Release -o /app/build
2020-09-03T08:00:50.5496428Z ---> Running in afaf6729f4fa
2020-09-03T08:00:51.2819871Z Microsoft (R) Build Engine version 16.7.0-preview-20360-03+188921e2f for .NET
2020-09-03T08:00:51.2820120Z Copyright (C) Microsoft Corporation. All rights reserved.
2020-09-03T08:00:51.2820238Z
2020-09-03T08:00:53.0044398Z Determining projects to restore...
2020-09-03T08:00:53.5041025Z All projects are up-to-date for restore.
2020-09-03T08:00:53.6243808Z You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
2020-09-03T08:00:53.6244559Z You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
2020-09-03T08:00:54.8928782Z /usr/share/dotnet/sdk/5.0.100-preview.7.20366.15/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(195,5): error MSB4018: The "GenerateDepsFile" task failed unexpectedly. [/ClassLibrary1/ClassLibrary1.csproj]
2020-09-03T08:00:54.8929578Z /usr/share/dotnet/sdk/5.0.100-preview.7.20366.15/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(195,5): error MSB4018: System.IO.IOException: The process cannot access the file '/app/build/ClassLibrary1.deps.json' because it is being used by another process. [/ClassLibrary1/ClassLibrary1.csproj]
2020-09-03T08:00:54.8935929Z /usr/share/dotnet/sdk/5.0.100-preview.7.20366.15/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(195,5): error MSB4018: at System.IO.FileStream.Init(FileMode mode, FileShare share, String originalPath) [/ClassLibrary1/ClassLibrary1.csproj]
2020-09-03T08:00:54.8936631Z /usr/share/dotnet/sdk/5.0.100-preview.7.20366.15/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(195,5): error MSB4018: at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) [/ClassLibrary1/ClassLibrary1.csproj]
2020-09-03T08:00:54.8943017Z /usr/share/dotnet/sdk/5.0.100-preview.7.20366.15/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(195,5): error MSB4018: at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize) [/ClassLibrary1/ClassLibrary1.csproj]
2020-09-03T08:00:54.8943612Z /usr/share/dotnet/sdk/5.0.100-preview.7.20366.15/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(195,5): error MSB4018: at System.IO.File.Create(String path) [/ClassLibrary1/ClassLibrary1.csproj]
2020-09-03T08:00:54.8944220Z /usr/share/dotnet/sdk/5.0.100-preview.7.20366.15/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(195,5): error MSB4018: at Microsoft.NET.Build.Tasks.GenerateDepsFile.WriteDepsFile(String depsFilePath) [/ClassLibrary1/ClassLibrary1.csproj]
2020-09-03T08:00:54.8948105Z /usr/share/dotnet/sdk/5.0.100-preview.7.20366.15/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(195,5): error MSB4018: at Microsoft.NET.Build.Tasks.GenerateDepsFile.ExecuteCore() [/ClassLibrary1/ClassLibrary1.csproj]
2020-09-03T08:00:54.8948685Z /usr/share/dotnet/sdk/5.0.100-preview.7.20366.15/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(195,5): error MSB4018: at Microsoft.NET.Build.Tasks.TaskBase.Execute() [/ClassLibrary1/ClassLibrary1.csproj]
2020-09-03T08:00:54.8952595Z /usr/share/dotnet/sdk/5.0.100-preview.7.20366.15/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(195,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [/ClassLibrary1/ClassLibrary1.csproj]
2020-09-03T08:00:54.8956187Z /usr/share/dotnet/sdk/5.0.100-preview.7.20366.15/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(195,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [/ClassLibrary1/ClassLibrary1.csproj]
2020-09-03T08:00:54.8989765Z ClassLibrary1 -> /app/build/ClassLibrary1.dll
2020-09-03T08:00:55.0730864Z NUnitTestProject1 -> /app/build/NUnitTestProject1.dll
2020-09-03T08:00:55.0949798Z
2020-09-03T08:00:55.0950154Z Build FAILED.
2020-09-03T08:00:55.0955028Z
2020-09-03T08:00:55.0960284Z /usr/share/dotnet/sdk/5.0.100-preview.7.20366.15/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(195,5): error MSB4018: The "GenerateDepsFile" task failed unexpectedly. [/ClassLibrary1/ClassLibrary1.csproj]
2020-09-03T08:00:55.0978113Z /usr/share/dotnet/sdk/5.0.100-preview.7.20366.15/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(195,5): error MSB4018: System.IO.IOException: The process cannot access the file '/app/build/ClassLibrary1.deps.json' because it is being used by another process. [/ClassLibrary1/ClassLibrary1.csproj]
2020-09-03T08:00:55.0982645Z /usr/share/dotnet/sdk/5.0.100-preview.7.20366.15/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(195,5): error MSB4018: at System.IO.FileStream.Init(FileMode mode, FileShare share, String originalPath) [/ClassLibrary1/ClassLibrary1.csproj]
2020-09-03T08:00:55.0987064Z /usr/share/dotnet/sdk/5.0.100-preview.7.20366.15/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(195,5): error MSB4018: at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) [/ClassLibrary1/ClassLibrary1.csproj]
2020-09-03T08:00:55.0992692Z /usr/share/dotnet/sdk/5.0.100-preview.7.20366.15/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(195,5): error MSB4018: at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize) [/ClassLibrary1/ClassLibrary1.csproj]
2020-09-03T08:00:55.0993265Z /usr/share/dotnet/sdk/5.0.100-preview.7.20366.15/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(195,5): error MSB4018: at System.IO.File.Create(String path) [/ClassLibrary1/ClassLibrary1.csproj]
2020-09-03T08:00:55.0998724Z /usr/share/dotnet/sdk/5.0.100-preview.7.20366.15/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(195,5): error MSB4018: at Microsoft.NET.Build.Tasks.GenerateDepsFile.WriteDepsFile(String depsFilePath) [/ClassLibrary1/ClassLibrary1.csproj]
2020-09-03T08:00:55.0999330Z /usr/share/dotnet/sdk/5.0.100-preview.7.20366.15/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(195,5): error MSB4018: at Microsoft.NET.Build.Tasks.GenerateDepsFile.ExecuteCore() [/ClassLibrary1/ClassLibrary1.csproj]
2020-09-03T08:00:55.1006812Z /usr/share/dotnet/sdk/5.0.100-preview.7.20366.15/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(195,5): error MSB4018: at Microsoft.NET.Build.Tasks.TaskBase.Execute() [/ClassLibrary1/ClassLibrary1.csproj]
2020-09-03T08:00:55.1007449Z /usr/share/dotnet/sdk/5.0.100-preview.7.20366.15/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(195,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [/ClassLibrary1/ClassLibrary1.csproj]
2020-09-03T08:00:55.1008224Z /usr/share/dotnet/sdk/5.0.100-preview.7.20366.15/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(195,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [/ClassLibrary1/ClassLibrary1.csproj]
2020-09-03T08:00:55.1008446Z 0 Warning(s)
2020-09-03T08:00:55.1008574Z 1 Error(s)
2020-09-03T08:00:55.1008644Z
2020-09-03T08:00:55.1008769Z Time Elapsed 00:00:03.68
2020-09-03T08:00:55.2952741Z The command '/bin/sh -c dotnet build -c Release -o /app/build' returned a non-zero code: 1
2020-09-03T08:00:55.2960996Z ##[error]Process completed with exit code 1.
A solution (to those who can just break with the past...) is to remove the reference to netcoreapp3.1.
The problem is you're using the -o command line option on a multi-targeted project. So it's trying to build the output for both target frameworks to the same folder, which is causing errors.
This is an ugly one for people upgrading from netcoreapp3.1 to net5.0..
The setup:
ClassLibrary1\ClassLibrary1.csproj
:NUnitTestProject1/NUnitTestProject1.csproj
:(Side note: the path suggests NUnit, but the reference was removed, as that's not the root of the issue at all.)
Now the build process:
The build will fail on the last command. The error log is:
A solution (to those who can just break with the past...) is to remove the reference to
netcoreapp3.1
.A full repo showing the issue is available here: https://github.com/stefanloerwald/dotnet-build-targetframeworks-bug. It includes a github action to demonstrate that the issue does not just exist on my machine.
The text was updated successfully, but these errors were encountered: