Quantcast
Channel: MSBuild forum
Viewing all articles
Browse latest Browse all 2763

"because it is being used by another process" error has me dead in the water.

$
0
0

I've been dealing with this error using VS 2017 for a year now. I compile my solution which contains about 100 projects and some of the projects fail for this reason. I simply build again and the projects that failed will build though other projects might fail further down the line. Ultimately, as I keep building (making no changes in between), they will all pass. Since it only happened on my laptop and desktop and not on the build server I just always did multiple builds and tolerated it.

However, now it has hit the build server and I can no longer get a build completed, so I had to take the precious time to investigate it more. I tried VS2019 to see it if would change anything - nope. Then I started keeping track of which of the approx. 100 projects it would fail on. That led me to notice that when it failed, it was always where a second compilation pass was occurring. Searching the build log for "MarkupCompilePass2:" revealed that all the projects that failed were undergoing a second compile before the failure. Here is a sample of lines (empty lines added for clarity) from the build log where one of the failure occurs (note my bolding):

PrepareForBuild:

Creating directory "obj\x86\Release_Signed\".

Project "C:\agent\_work\1\s\VS5\VS5.Comms.SignalStrength\VS5.Comms.SignalStrength.vbproj" (65:2) is building "C:\agent\_work\1\s\VS5\VS5.Comms.SignalStrength\VS5.Comms.SignalStrength_pecgedwc_wpftmp.vbproj" (75) on node 1 (_CompileTemporaryAssembly target(s)).

CoreCompile:

  C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Roslyn\vbc.exe /noconfig /imports: ... blah, blah, blah ...

  Using shared compilation with compiler from directory: C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Roslyn

Done Building Project "C:\agent\_work\1\s\VS5\VS5.Comms.SignalStrength\VS5.Comms.SignalStrength_pecgedwc_wpftmp.vbproj" (_CompileTemporaryAssembly target(s)).

MarkupCompilePass2:

  MarkupCompilePass2 successfully generated BAML or source code files.

CleanupTemporaryTargetAssembly:

  Deleting file "obj\x86\Release_Signed\VS5.Comms.SignalStrength.dll".

##[error]C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.WinFx.targets(480,10):Error MSB3061: Unable to delete file "obj\x86\Release_Signed\VS5.Comms.SignalStrength.dll". The process cannot access the file 'C:\agent\_work\1\s\VS5\VS5.Comms.SignalStrength\obj\x86\Release_Signed\VS5.Comms.SignalStrength.dll' because it is being used by another process.

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.WinFx.targets(480,10): error MSB3061: Unable to delete file "obj\x86\Release_Signed\VS5.Comms.SignalStrength.dll". The process cannot access the file 'C:\agent\_work\1\s\VS5\VS5.Comms.SignalStrength\obj\x86\Release_Signed\VS5.Comms.SignalStrength.dll' because it is being used by another process. [C:\agent\_work\1\s\VS5\VS5.Comms.SignalStrength\VS5.Comms.SignalStrength.vbproj]

Done Building Project "C:\agent\_work\1\s\VS5\VS5.Comms.Signal

-------------------------------------

Is there a way around this?


Viewing all articles
Browse latest Browse all 2763

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>