I get this error repeatedly when developing ASP.Net applications:
Cannot create/shadow copy \'XXXXX\' when that file already exists
Where
I was getting the same issue, by placing this code in a web.config worked for me.
<hostingEnvironment shadowCopyBinAssemblies="false" />
The following workarounds come from this now defunct connect issue:
<hostingEnvironment shadowCopyBinAssemblies="false" />
to the <system.web>
section of your web.config file.Add the following to your pre-build events:
IF EXIST $(TargetPath).LOCKED (del $(TargetPath).LOCKED) ELSE (IF EXIST $(TargetPath) (move $(TargetPath) $(TargetPath).LOCKED))
A workaround that does the job for me is instead of using "Build" use "Build Solution"
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i
. This more than likely won't work for everyone - it's a complex problem.EDIT: Items retrieved from an old version of the page (courtesy of archive.org).
In my situation only iisreset
worked.
Wait somewhere between 10-30 seconds and hit refresh. For some reason this always works for me.
Just restart Visual studio, that worked for me.
Open your project properties, open the Web tab and make sure the Enable Edit and Continue option is not checked.