I get this error repeatedly when developing ASP.Net applications:
Cannot create/shadow copy \'XXXXX\' when that file already exists
Where
GO to the design mode and then right click and hit view in browser, the issue will go away Anil Madan
If you use Entity Framework:
Error Message: "Cannot create/shadow copy '' when that file already exists."
Solution: "Wait a few seconds and refresh the page."
For more information please visit: Advanced Entity Framework 6 Scenarios for an MVC 5 Web Application (12 of 12)
You just Refresh (F5) your page.
Add these lines in the pre-build event command line, which basically unlocks the DLL within Visual Studio:
IF EXIST $(TargetPath).LOCKED (del $(TargetPath).LOCKED)
ELSE (IF EXIST $(TargetPath) (move $(TargetPath) $(TargetPath).LOCKED))
Re-compile and your unable to copy DLL error will not occur.
I was getting this issue frequently when working with an imported DLL which we created.
Attempts to stop is happening failed, and even introduced different problems, but whenever it occurred I would just do a rebuild solution and the problem would immediately disappear for that build.
Also, I haven't seen the problem since working on Visual Studio 2002. 2008 does not have this issue that I know of, neither does 2005. Are you using an older VS?