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

» How to Shutdown or Restart Windows From the Command Line

To shutdown or restart windows from the command line or using a shortcut, you must use the Shutdown.exe program. To use this program, open up a command prompt window. This can be done by navigating to Start -> Run and typing in 'cmd'.Once the command prompt is open, use the following command:shutdown [-i | -l | -s | -r | -a] [-f] [-m computername] [-t xx] [-c "comment"] [-d up:xx:yy]Arguments:  No args Display this message (same as -?)-i Display GUI interface, must be the...

» How to Setup and Secure a Wireless Network Using a Linksys Router

First thing to do is setup your router. Make sure you hook up the power cable, the modem, and all wired computers to the router. Once this has been done, verify that you can see the wireless network associated with your router. A newly created network will most likely be named 'linksys'.Open a web browser on one of the computers connected to the network. Once the web browser is open, type http://192.168.1.1 into the address bar. This will take you to the routers build-in administrator portal....

» Merge Two Versions of A Table Together in a Database

When keeping multiple versions of a website, or perhaps migrating a website to a new environment, it is often necessary to merge any changes between the two databases. The databases have the same structure, but each has new, unique content which needs to be added to the other. The following tutorial uses syntax for MySQL, however it should be applicable to other major database schemas. The following example assumes that the master database where we want all of the changes to reside is called...