question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

File in use problems

See original GitHub issue

I am using .NET Core and in a short timespan, I see the following two errors. They are intermittent (build again and the error goes away). I am using VS Code at the same time (if that matters). I have never seen this before. Any clues what might be going on? These are serious issues if at all pervasive.

C:\git\testapps\cpumath>dotnet build
Microsoft (R) Build Engine version 16.1.46-preview+ge12aa7ba78 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 971.7 ms for C:\git\testapps\cpumath\cpumath.csproj.
C:\Program Files\dotnet\sdk\3.0.100-preview4-011022\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(151,5): message NETSDK1057: You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview [C:\git\testapps\cpumath\cpumath.csproj]
C:\Program Files\dotnet\sdk\3.0.100-preview4-011022\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.GenerateAssemblyInfo.targets(133,5): error MSB3713: The file "obj\Debug\netcoreapp3.0\cpumath.AssemblyInfo.cs" could not be created. The process cannot access the file 'C:\git\testapps\cpumath\obj\Debug\netcoreapp3.0\cpumath.AssemblyInfo.cs' because it is being used by another process. [C:\git\testapps\cpumath\cpumath.csproj]
C:\Program Files\dotnet\sdk\3.0.100-preview4-011022\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(151,5): message NETSDK1057: You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview [C:\git\testapps\cpumath\cpumath.csproj]
  cpumath -> C:\git\testapps\cpumath\bin\Debug\net472\cpumath.exe

Build FAILED.

C:\Program Files\dotnet\sdk\3.0.100-preview4-011022\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.GenerateAssemblyInfo.targets(133,5): error MSB3713: The file "obj\Debug\netcoreapp3.0\cpumath.AssemblyInfo.cs" could not be created. The process cannot access the file 'C:\git\testapps\cpumath\obj\Debug\netcoreapp3.0\cpumath.AssemblyInfo.cs' because it is being used by another process. [C:\git\testapps\cpumath\cpumath.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:02.25

And then:

C:\git\testapps\cpumath>dotnet build
Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restoring packages for C:\git\testapps\cpumath\cpumath.csproj...
  Generating MSBuild file C:\git\testapps\cpumath\obj\cpumath.csproj.nuget.g.props.
  Generating MSBuild file C:\git\testapps\cpumath\obj\cpumath.csproj.nuget.g.targets.
  Restore completed in 345.7 ms for C:\git\testapps\cpumath\cpumath.csproj.
C:\Program Files\dotnet\sdk\2.2.105\Microsoft.Common.CurrentVersion.targets(2110,5): warning MSB3101: Could not write state file "obj\Debug\netcoreapp2.2\cpumath.csprojAssemblyReference.cache". The process cannot access the file 'C:\git\testapps\cpumath\obj\Debug\netcoreapp2.2\cpumath.csprojAssemblyReference.cache' because it is being used by another process. [C:\git\testapps\cpumath\cpumath.csproj]
  cpumath -> C:\git\testapps\cpumath\bin\Debug\netcoreapp2.2\cpumath.dll

Build succeeded.

C:\Program Files\dotnet\sdk\2.2.105\Microsoft.Common.CurrentVersion.targets(2110,5): warning MSB3101: Could not write state file "obj\Debug\netcoreapp2.2\cpumath.csprojAssemblyReference.cache". The process cannot access the file 'C:\git\testapps\cpumath\obj\Debug\netcoreapp2.2\cpumath.csprojAssemblyReference.cache' because it is being used by another process. [C:\git\testapps\cpumath\cpumath.csproj]
    1 Warning(s)
    0 Error(s)

Time Elapsed 00:00:04.33

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
richlandercommented, Apr 14, 2019

This is still happening to me when VS Code is open (on other projects). I am now seeing it when I “build” from within VS Code. In that scenario, there is no way to avoid VS Code being open.

There is some symmetry to a similar challenge we have with dotnet watch in a container. This PR documents that challenge. I wonder if we need to take a similar approach.

0reactions
richlandercommented, Apr 2, 2019

I will continue to monitor this. Yes, VS Code was open the whole time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

“File in use” error on Windows 10 [Fix]
1. File in use error · Open File Explorer. · Click the View tab and check File name extensions option. · After doing...
Read more >
File In Use error
I am increasingly unable to delete a file because Word thinks it's open elsewhere. It is not open elsewhere.
Read more >
4 Easy Ways to Resolve “File in Use” Error on Windows 10
How to Fix File in Use Error on Windows 10? · Solution #1: Remove Third-Party Apps · Solution #2: Terminate All Running Applications...
Read more >
How to fix File in Use Error in Windows 10 - Helpful Guide
To solve this problem, make sure to close all applications that are running and try to delete the file. Also, restart your PC...
Read more >
How to Solve "File Is Open in Another Program" Error ...
1. Check Whether the File Is Open on Another Computer · 2. Locate the File in Task Manager · 3. Restart File Explorer...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found