Cannot create/shadow copy 'File Name' when that file already exists

Posted by Anuraj on Thursday, September 12, 2013

.Net .Net 4.0 ASP.Net ASP.Net MVC Visual Studio

Sometimes while debugging ASP.Net applications, intermittently you may get an error like this.

Cannot create/shadow copy

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. ASP.Net does this because the original file is not locked and can be modified. This error can be resolved, if you wait a few moments before pressing F5 after a build, ASP.NET seems to have the time to complete whatever it needs to do.

You can also modify web.config to resolve the issue.

<system.web>
   <hostingEnvironment shadowCopyBinAssemblies="false" />
</system.web>

Happy Programming.


Similar Posts


Did you like this article? Share it with your friends

Facebook Twitter Google+ LinkedIn Reddit StumbleUpon



MVP
Subscribe
Archives


Copyright © 2017 - Anuraj P. Blog content licensed under the Creative Commons CC BY 2.5 | Unless otherwise stated or granted, code samples licensed under the MIT license. This is a personal blog. The opinions expressed here represent my own and not those of my employer. Hosted with ❤ by GitHub