dotnet build errror when starting a bot project (because it is being used by another process)
See original GitHub issueDescribe the bug
I’ve seen this a number of times now when switching between different bot projects. Bots start to report errors when starting due to the .exe being used by another process. bot project has only been launched as part of using Composer, VS hasn’t been opened against the csproj or anything outside composer.
Digging around in task manager it seems djbfskill6 had a process running in the background, Composer perhaps isn’t terminating these processes correctly in some instances?
Error occurred building the bot
Message:
Command failed: dotnet build djbfskill1.csproj
Command:
dotnet build djbfskill1.csproj
Stack Trace:
Error: Command failed: dotnet build djbfskill1.csproj
at ChildProcess.exithandler (child_process.js:308:12)
at ChildProcess.emit (events.js:210:5)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
Output:
Microsoft (R) Build Engine version 16.9.0+57a23d249 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj : warning NU1701: Package 'Microsoft.Azure.KeyVault.Core 1.0.0' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETCoreApp,Version=v3.1'. This package may not be fully compatible with your project.
All projects are up-to-date for restore.
C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj : warning NU1701: Package 'Microsoft.Azure.KeyVault.Core 1.0.0' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETCoreApp,Version=v3.1'. This package may not be fully compatible with your project.
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 1 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 2 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 3 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 4 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 5 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 6 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 7 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 8 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 9 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 10 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): error MSB3027: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Exceeded retry count of 10. Failed. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): error MSB3021: Unable to copy file "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
Build FAILED.
C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj : warning NU1701: Package 'Microsoft.Azure.KeyVault.Core 1.0.0' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETCoreApp,Version=v3.1'. This package may not be fully compatible with your project.
C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj : warning NU1701: Package 'Microsoft.Azure.KeyVault.Core 1.0.0' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETCoreApp,Version=v3.1'. This package may not be fully compatible with your project.
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 1 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 2 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 3 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 4 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 5 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 6 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 7 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 8 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 9 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 10 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): error MSB3027: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Exceeded retry count of 10. Failed. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): error MSB3021: Unable to copy file "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
Version
1.4.0-nightly.237101
Browser
- Electron distribution
- Chrome
- Safari
- Firefox
- Edge
OS
- macOS
- Windows
- Ubuntu
Issue Analytics
- State:
- Created 2 years ago
- Comments:18 (17 by maintainers)
Top Results From Across the Web
Build error: "The process cannot access the file because it is ...
The process cannot access the file "bin\Debug\MyProject.exe" because it is being used by another process. Googling the error doesn't come up ...
Read more >Can't run tests. dll being used by another process
I added a test project to my ASP.NET Core 1.1 app and I can't build now because the app dll is being used...
Read more >dotnet/runtime - Gitter
IOException: The process cannot access the file '/app/build/Foo.deps.json' because it is being used by another process. in a docker build process is ...
Read more >dotnet build command - .NET CLI | Microsoft Learn
The dotnet build command builds a project and all of its dependencies.
Read more >Solution: The Process Can Not Access The File Because It Is ...
The main cause for this error is because the port is already being used by another project. The error code 0x80070020 means ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Awesome demo of the POC, it looks very promising. In terms of timeline, at this moment i don’t think we have resource to include this in R14, what do you think? How about we move this to R15?
Shiproom - we’ve fixed some of these scenarios. At this point, I’m moving this out of R13 for consideration in a post build release