msbuild icon indicating copy to clipboard operation
msbuild copied to clipboard

dotnet build errors with a file locked by itself (concurrency issue)

Open Richard-Payne opened this issue 4 months ago • 5 comments

Describe the bug

We have a straight forward app with main, service, and interface projects.

Very similar to this: https://github.com/dotnet/sdk/issues/9585 Although, we're building against the csproj to try ruling out sln based issues. This should just be building the main project and its project references.

To Reproduce

I was going to upload a binlog, but apparently you won't let me. Tell how to get it to you.

Exceptions

CSC : error CS2012: Cannot open 'E:\Code\bi-sports-sportradar\Source\SportsRadar.Interface\obj\Release\net8.0\win-x64\SportRadar.Interface.dll' for writing -- The process cannot access the file 'E:\Code\bi-sports-sportradar\Source\SportsRadar.Interface\obj\Release\net8.0\win-x64\SportRadar.Interface.dll' because it is being used by another process.

Further technical details

details of dotnet --info

.NET SDK: Version: 9.0.304 Commit: f12f5f689e Workload version: 9.0.300-manifests.ad61bb1c MSBuild version: 17.14.16+5d8159c5f

Runtime Environment: OS Name: Windows OS Version: 10.0.26100 OS Platform: Windows RID: win-x64 Base Path: C:\Program Files\dotnet\sdk\9.0.304\

.NET workloads installed: [aspire] Installation Source: VS 17.14.36408.4 Manifest Version: 8.2.2/8.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.2.2\WorkloadManifest.json Install Type: Msi

Configured to use loose manifests when installing new manifests.

Host: Version: 9.0.8 Architecture: x64 Commit: aae90fa090

.NET SDKs installed: 6.0.201 [C:\Program Files\dotnet\sdk] 6.0.428 [C:\Program Files\dotnet\sdk] 7.0.203 [C:\Program Files\dotnet\sdk] 9.0.304 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 9.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 9.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.19 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 9.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found: x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables: Not set

global.json file: Not found

Learn more: https://aka.ms/dotnet/info

Download .NET: https://aka.ms/dotnet/download

Richard-Payne avatar Aug 19 '25 15:08 Richard-Payne

Thanks for reporting - for binlogs you can either report through VS Developer Community, where you can create a ticket and then separately attach the binlog as a private artifact, or if you're not concerned about private info/names/etc you can rename it to a file type that GitHub does accept (like .zip) and attach it here.

baronfel avatar Aug 19 '25 15:08 baronfel

It's been run through the redaction function in the Structured Log Viewer

radar-redacted.binlog.zip

Richard-Payne avatar Aug 20 '25 07:08 Richard-Payne

Anyone?

Richard-Payne avatar Sep 30 '25 06:09 Richard-Payne

Seen similar intermittent on CI with .NET 10 SDK, rebuilding sorts it.

/Users/vagrant/git/src/Cake.Frosting.Template/Cake.Frosting.Template.csproj(25,4): error MSB3733: Input file "templates/cakefrosting/build/Build.csproj" cannot be opened. 
The process cannot access the file '/Users/vagrant/git/src/Cake.Frosting.Template/templates/cakefrosting/build/Build.csproj' 
because it is being used by another process. [TargetFramework=net10.0]

devlead avatar Oct 24 '25 18:10 devlead

Seen similar intermittent on CI with .NET 10 SDK, rebuilding sorts it.

Yeah, rebuilding generally works, but not always. Sometimes it take 2, 3, or sometimes even 4 stabs at it. This is not helpful for a CI system.

Richard-Payne avatar Nov 28 '25 13:11 Richard-Payne