10.0.102: error MSB4018: The "GenerateDepsFile" task failed unexpectedly building net8.0 with multiple TFM
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
### Describe the bug
When building with multiple TFM, "error MSB4018: The "GenerateDepsFile" task failed unexpectedly" occurs. This is in a CI shell environment. Multiple runs will eventually succeed (race condition).
### To Reproduce
A .NET project with TargetFrameworks net8.0 and net10.0 using 10.0.102 SDK in a Linux environment.
### Logs
```
/usr/share/dotnet/sdk/10.0.102/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(308,5): error MSB4018:
The "GenerateDepsFile" task failed unexpectedly. [***.csproj::TargetFramework=net8.0]
System.IO.IOException: The process cannot access the file '***.deps.json' because it is being used by another process. [***.csproj::TargetFramework=net8.0]
at Microsoft.Win32.SafeHandles.SafeFileHandle.Init(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Int64& fileLength, UnixFileMode& filePermissions) [***.csproj::TargetFramework=net8.0]
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, UnixFileMode openPermissions, Int64& fileLength, UnixFileMode& filePermissions, Boolean failForSymlink, Boolean& wasSymlink, Func`4 createOpenException) [***.csproj::TargetFramework=net8.0]
at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode) [***.csproj::TargetFramework=net8.0]
at System.IO.File.Create(String path) [***.csproj::TargetFramework=net8.0]
at Microsoft.NET.Build.Tasks.GenerateDepsFile.WriteDepsFile(String depsFilePath) [***.csproj::TargetFramework=net8.0]
at Microsoft.NET.Build.Tasks.TaskBase.Execute() [***.csproj::TargetFramework=net8.0]
at Microsoft.Build.BackEnd.TaskExecutionHost.Execute() [***.csproj::TargetFramework=net8.0]
at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(TaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [***.csproj::TargetFramework=net8.0]
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.