I get this error repeatedly when developing ASP.Net applications:
Cannot create/shadow copy 'XXXXX' when that file already exists
Where XXXXX is a random DLL. Typically the DLL is one of the DLLs from Microsoft's Enterprise Library, but it varies.
It's really random, and it's very frustrating. I will go hours without getting the error, and then get this error every 10-20 minutes.
I've seen several solutions. For instance, this question. I've tried using Clean Solution option, and I've also simply restarted my local IIS. However, it still occurs at the same random but persistent frequency.
I've also seen many people mention using this option in the config file:
<hostingEnvironment shadowCopyBinAssemblies="false" />
However, others have mentioned it being problematic, and it should definitely not be used in production.
So, should I just give up and try the shadowCopyBinAssemblies option? (And make sure not to copy this change to other environments.) Am I the only one who gets this issue that often?
Note: I am using Visual Studio 2008.
Wait somewhere between 10-30 seconds and hit refresh. For some reason this always works for me.
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).
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