Bug 44613 - Unable to copy DLL because it is being used by another process
Summary: Unable to copy DLL because it is being used by another process
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-09-22 09:23 UTC by Rob Lyndon
Modified: 2016-12-28 14:19 UTC (History)
4 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Rob Lyndon 2016-09-22 09:23:04 UTC
I have two Xamarin Forms projects in my solution.

After I added the second one, Visual Studio builds started breaking on a regular basis.

The error takes the form

Unable to copy file "C:\<Path>\Domain.dll" to "bin\Debug-Live\Domain.dll". The process cannot access the file 'bin\Debug-Live\Domain.dll' because it is being used by another process. <Path>.Windows

The bug can affect the Windows project, the iOS project, the Droid project, the UWP project or the WindowsPhone project. Once it happens even a system restart doesn't fix the problem. The only way to fix it is to close Visual Studio, delete the bin folder in the reported project, and restart Visual Studio. Because startup times for Xamarin projects are very slow, this process can take 10 - 20 minutes, and it is destroying my productivity.
Comment 1 Rob Lyndon 2016-09-28 14:56:51 UTC
I have tried to delete the bin folder from Visual Studio. The deletioo fails with the message "The system call level is not correct".

Trying to delete the bin folder from Windows Explorer before Visual Studio has been closed also fails. The message is "The action can't be completed because the folder or a file in it is open in another program." However, the shell command tasklist /m shows no processes using the file that is supposedly locked.
Comment 2 Al Clark [MSFT] 2016-10-12 11:17:26 UTC
Would you please be able to include your full version information along with a sample project that exhibits the issue here?

Visual Studio
Help -> About Microsoft Visual Studio -> Copy Info [button]

A screencast may also help:

Comment 3 Rob Lyndon 2016-12-28 14:19:25 UTC
Doesn't seem to be an issue with the latest version.