Cannot create/shadow copy when that file already exists

The .Net Framework has a feature called Shadow Copy. Shadow copy is enabled on every appdomain created by ASP.NET by default. By default assemblies loaded will be copied to a shadow copy cache directory, and will be used from that location. Why does ASP.Net do this? So the original file is not locked and can be modified. An interesting error I have ran into intermittently when running ASP.Net apps with the debugger is ‘Cannot create/shadow copy when that file already exists‘ I’m still not sure why this happens only on occasion, as I can often clean my solution, then reload a web app and it will work fine then. But if you are getting it frequently enough for it to affect your work, you can add the following to your app’s web.config or the master .Net web.config:

<system.web>
   <hostingEnvironment shadowCopyBinAssemblies="false" />
</system.web>
   Thanks Rana Faisal Munir

10 thoughts on “Cannot create/shadow copy when that file already exists

  1. Thanks for yor personal marvellous posting! I seriously enjoyed
    reading it, yyou will be a greqt author. I will ensure that I bookmark yur blogg and will
    come back in the future. I want to encourage continue your great job, have
    a nice evening!

Leave a reply to Kristopher Cancel reply