Unable to Copy File

  • Thread starter Thread starter John Murray
  • Start date Start date
Does anyone know why in 2005 I might be getting this error everytime I try
and recompile?

Error 226 Unable to copy file "obj\Debug\myfile.dll" to
"bin\Debug\myfile.dll". The process cannot access the file
'bin\Debug\myfile.dll' because it is being used by another process. myfile
 
Also if I did and unloaded the second instance and the first instance should
compile correct?
 
Even after I unlock the dll using the unlocker, I still cannot compile. The
only way I have found that will fix this is to leave the IDE and Restart the
IDE.
 
Very strange.... Is it the IDE that has the file locked? Can you delete
the file after unlocking by either using the unlocker's delete function or
from the Explorer? If you can successfully delete the file outside of the
VS IDE can you then compile successfully?

There might be a bug like this logged for VS2005 already, but I am not
sure...
 
VS only locks one version of the file, and you CAN rename/move it.
You can use the following commands in the pre-build event of the
problem-project to workaround the problem:

if exist "$(TargetPath).locked" del "$(TargetPath).locked"
if not exist "$(TargetPath).locked" move "$(TargetPath)"
"$(TargetPath).locked"
 
Back
Top