I use the latest Visual Studio Community 2017 (15.4). And since i installed Visual Studio (never worked in it before). I have ALWAYS despite version had this issue. After compiling a couple of times i start to see:
Unable to copy file "obj\Debug\afile.exe" to "bin\Debug\afile.exe". The process cannot access the file 'bin\Debug\afile.exe' because it is being used by another process.
I searched around and tried just about everything. Nothing works for me. It can be fine for some time but after a while it starts to show again and i can´t compile.
I run on a Windows 7 OS. I have Avast installed and Comodo Firewall. The project is under SourceTree sourcecontroll. I have excluded the obj and bin path in programs.
I have tried changing AssemblyVersion and AssemblyFileVersion. I have tried uninstalling Avast. I have tried "ProcessExplorer" to find what process is accessing the files (0 match).
I really don´t know what more i can do? This is getting really frustrating when you are testing the code you wrote a couple of seconds ago.
I have seen old threads about this issue. Is there nothing i can do to fix this?
In Source Control Explorer, open the shortcut menu for the folder or file from which you want to remove a lock, and then choose Unlock.
Unlock a file Select the file you want to unlock, or open it in the editor. Select VCS | Subversion | Unlock from the main menu, or Subversion | Unlock from the context menu of the selection. To forcibly break a lock set by somebody else, select the Steal Existing Lock checkbox.
If you choose unlimited, the file will be locked until you unlock it manually. You can also choose to prevent users from downloading the file while you are editing it. A lock icon to the left of the file's name will indicate that the file has been locked.
When I had this problem, I solved killing the process VBCSCompiler.exe
and everything came back normal.
But after the latest updates of the Visual Studio I do not have more this issue.
To finalize the process, you need execute the command taskkill /F /IM VBCSCompiler.exe
in cmd, or search the process in manager process of the Windows.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With