Cannot create/shadow copy 'your assembly info here' when that file already exists

I encountered his error for the first time today. A Web Application Project I've been working on for the last months started throwing this error today almost every time I wanted to debug the project. The assembly info changed from time to time, but the error was the same. Most of the time I could 'repair' it by closing the ASP.Net development server. But sometimes, even that didn't work.

After the first time it hit me today, I kept encountering this until I was fed up. I searched the internet, but there's not much documented about this little bug. There are more people with the same problem but I didn't find a solution at first. Then I found this page. That's the exact error I'm getting! And now I think of it, I too always build my solution before I press F5 to debug. After searching based on that page, I found this post here. It seems there's a web.config solution for this problem: adding <hostingEnvironment shadowCopyBinAssemblies="false" /> to the system.web element of your web.config file. The 'shadowCopyBinAssemblies' property is described as follows: Sets a Boolean value indicating whether the assemblies of an application in the Bin directory are shadow copied to the application's ASP.NET Temporary Files directory.

Hope this helps.

Published Wed, Feb 14 2007 4:19 PM by Rick van den Bosch
Filed under:

Comments

# re: Cannot create/shadow copy 'your assembly info here' when that file already exists

Have you notice any side effects/issues after setting shadowCopyBinAssemblies="false" ?

Wednesday, February 21, 2007 4:28 PM by Michael Freidgeim

# re: Cannot create/shadow copy 'your assembly info here' when that file already exists

Same problem for a few days....this most definitely helped.  

Thank you!

Wednesday, February 28, 2007 2:31 PM by Pedro Carbajal

# re: Cannot create/shadow copy 'your assembly info here' when that file already exists

It seems that fixed my headache right now, thank you very much :)

Sunday, April 08, 2007 1:18 PM by Jozef Sevcik

# re: Cannot create/shadow copy 'your assembly info here' when that file already exists

I too was getting this error constantly and was almost at the point of switching to notepad2 to code in like my good old pre visual studio days. I was using the Cassini server on my laptop and got so fed up decided to install IIS to run the pages through that instead. Once IIS was installed, I tried Cassini some more and have not received that error a single time since. So, just wanted to mention that as a possible fix for this issue for those still seeing it. Worked for me with nicely.

Oh, as an FYI, someone here www.mcse.ms/message2503855.html mentions a side effect of setting the shadowCopyBinAssemblies to false.

Tuesday, July 17, 2007 6:27 AM by Visitor

# re: Cannot create/shadow copy 'your assembly info here' when that file already exists

Try doing an IISReset.  That seems to work for me.

Friday, February 29, 2008 9:30 PM by Todd Andrews

# re: Cannot create/shadow copy 'your assembly info here' when that file already exists

>Try doing an IISReset

You can also:

Re-start VS

Re-start your computer

Put your finger in the air and whistle

All of these <may> fix the problem, as it is intermittent - one minute the error pops up, you close the browser and try again and the error doesn't pop up.

Wednesday, May 21, 2008 11:56 AM by Hackney Badger

# re: Cannot create/shadow copy 'your assembly info here' when that file already exists

Adding the entry in web.config fixed the problem. thanks for posting this.

Thursday, May 22, 2008 4:40 PM by visitor

# re: Cannot create/shadow copy 'your assembly info here' when that file already exists

Thanks, worked fine.

Saturday, June 14, 2008 9:12 PM by Rudolph

# re: Cannot create/shadow copy 'your assembly info here' when that file already exists

I started getting 'access denied' error. Do I need to do something else?

Friday, September 19, 2008 1:46 AM by Malay Thakershi

# re: Cannot create/shadow copy 'your assembly info here' when that file already exists

Thank you...

Tuesday, November 25, 2008 9:44 AM by rüya tabiri

# re: Cannot create/shadow copy 'your assembly info here' when that file already exists

Thanks. it worked for me. even though restarting IIS, VS, browser solves the problem, but its not permament solution. Better to add that little markup shadowCopyBinAssemblies="false" in the web.config file.

Friday, March 27, 2009 9:03 PM by Abdul

# re: Cannot create/shadow copy 'your assembly info here' when that file already exists

I had the same problem, but then realised I had a command prompt open located within the gac_msil\<dll>\<version> folder from when I had done the backup xcopy out of the gac.  

Closing this the update of the dll in the gac worked fine

Andy

Friday, May 01, 2009 3:59 PM by Andy

# re: Cannot create/shadow copy 'your assembly info here' when that file already exists

Hi,

Just for info this is caused by an important .NET feature - the compiled files (all your module DLLs, all the .cs codebehind classes and the dynamicly created _aspx classes generates from the .aspx files) are not actually executed in the /bin folder

Instead all these binaries are copied to a dynamically created subdirectory deep down in the 2.0 framework folder (same folder if you're using 3.5 as the core ASP.NET engine is the same) and executed here.

This feature is what allows you to update your .aspx files on the fly - without compiling and redeploying your core /bin binaries.

When you do this - all existing request (usres) are served from the /Windows/.NET/2.0 directory while your  /bin files are recompiled and then "shadow copied" into the .NET folder.

Interestingly all the .aspx files are dynamically compiles into classes named [pageclass]_aspx - which of course inherit from the .cs class defined as the codebehind.

This means users can continue to use your site while you are correcting your HTML (thou of course you should never ever do this as it slows the site completely - at least don't ever get caught doing it).

Thursday, May 07, 2009 5:00 AM by Tom Steel

# re: Cannot create/shadow copy 'your assembly info here' when that file already exists

Cleaning up ASP.NET temporary files worked for me

Monday, May 11, 2009 5:25 PM by Eliyahu

# re: Cannot create/shadow copy 'your assembly info here' when that file already exists

The easy way of avoiding the problem is to perform a Solution->Clean before running the web app.  This always fixs the problem.

Saturday, May 16, 2009 10:58 PM by Simon Hodgetts

# re: Cannot create/shadow copy 'your assembly info here' when that file already exists

Thanks,it worked for me.

Thursday, June 11, 2009 1:38 PM by Jony

# re: Cannot create/shadow copy 'your assembly info here' when that file already exists

Tried all of the above but still no luck ... any other tip that might solve this problem.

Monday, June 29, 2009 5:37 PM by John

# re: Cannot create/shadow copy 'your assembly info here' when that file already exists

thanks for your research, saved me [end tasking] asp_wp.exe every time i build and [F5]

brilliant!

Thursday, July 02, 2009 2:13 PM by Flemgrem

# re: Cannot create/shadow copy 'your assembly info here' when that file already exists

Cannot create/shadow copy 'your assembly info here' when that file already exists

add this code in Web.config in System.web section

<hostingEnvironment shadowCopyBinAssemblies="false" />

is working Thanks

Thursday, August 06, 2009 12:57 PM by Mukesh Chourasia

# re: Cannot create/shadow copy 'your assembly info here' when that file already exists

Added the code in the Web.config file and it works.

Thanks for your Info.

Wednesday, February 24, 2010 8:50 PM by Rajagopalan.

# re: Cannot create/shadow copy 'your assembly info here' when that file already exists

Thanks it worked for me....as well...but as Simon Hodgetts said its better to clean the solution before hitting F5.

Wednesday, April 07, 2010 3:49 PM by Bharath Reddy VasiReddy

# re: Cannot create/shadow copy 'your assembly info here' when that file already exists

Hi!

The same error occurs for me also.

I have cleaned the solution and build the solution.

Now it works fine.

Thanks ...

Saturday, April 10, 2010 11:59 AM by Usha

# re: Cannot create/shadow copy 'your assembly info here' when that file already exists

Andy Rocks

Wednesday, October 27, 2010 5:22 PM by Abbas

# The process cannot access the file because it is being used by another process

The process cannot access the file because it is being used by another process

Thursday, January 06, 2011 10:55 AM by Peter's .NET ramblings

# re: Cannot create/shadow copy 'your assembly info here' when that file already exists

Thanx

it worked for me

Monday, February 21, 2011 10:35 AM by Jasmine

# re: Cannot create/shadow copy 'your assembly info here' when that file already exists

Great work..! Thanks :)

Thursday, August 04, 2011 1:39 PM by Anish

Leave a Comment

(required) 
(required) 
(optional)
(required) 
Please add 8 and 5 and type the answer here: