ASP.NET Error: Cannot create/shadow copy when that file already exists.

(0 votes, average 0 out of 5)

 

Occasionally when using a debugger in ASP.NET (or shortly after using the debugger), your solution may return the following error when viewing in a browser:

Cannot create/shadow copy when that file already exists.

This is a problem rooted in how solutions build for ASP.NET - they are often built into binaries that are placed in a "shadow" location so that the user may continue editing and saving the code without any consequence to the current built solution.  Sometimes this process will not work correctly.  A quick solution is to Clean your solution.  This can be done in Visual Studio by navigating to Build -> Clean Solution.

However if this problem is occurring enough, it might be worth placing the following code into your web.config:

1
2
3
<system.web>
	<hostingEnvironment shadowCopyBinAssemblies="false" />
</system.web>

This will prevent the solution from making shadow binaries, but you will have to be more careful about editing your solution while testing it.

Partner Links:
Last Updated on Wednesday, 21 July 2010 08:03  
Related Articles

» Fix 'Build Path' Error or Missing File in Eclipse Project

Sometimes the Eclipse IDE will refuse to build a project - citing a missing resource or file or just a generic "build path" error. If the resource is not missing but in the folder where it should be, the build path may just need to be refreshed. If you encounter a build error when trying to run a project, try these steps to resolve it:Make all files in the project read-write. To do so, go to the Eclipse workspace in the file manager (e.g. Windows Explorer, Finder, or Nautilus), right-click on...

» How to Fix an Atari 2600: From Top to Bottom

Believe it or not, the Atari 2600 is one beast of a console, and very rarely dies. Its like the annoying brother you kick in the pants, and he still comes back. Here are some notes to keep your console looking fresh, clean, and working perfect. Don't forget, you need to use either the RF box that comes with the atari, or you can buy an RCA to Coax adapter. An automatic RF switching box will *not* work, because the atari signal isn't strong enough.Out of all of the consoles I like to work...

» Wallpaper Websites

Most people that use a computer often use a custom wallpaper. However, finding a website that can be reliable, have great wallpapers or desktops, and not contain spam or viruses can be hard to find. Here is a list of wallpaper vendors that are safe and provide users with breath-taking wallpapers: -> A great website that provides High-resolution widescreen wallpapers, desktop icons, and themes for Mac OS X, Microsoft Windows, and Linux. Interface lift provides website in their default...