Rick van den Bosch - Blog

... on software development, architecture and more

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.

Comments

Michael Freidgeim said:

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

# February 21, 2007 4:28 PM

Pedro Carbajal said:

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

Thank you!

# February 28, 2007 2:31 PM

Jozef Sevcik said:

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

# April 8, 2007 1:18 PM

Visitor said:

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.

# July 17, 2007 6:27 AM

Todd Andrews said:

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

# February 29, 2008 9:30 PM

Hackney Badger said:

>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.

# May 21, 2008 11:56 AM

visitor said:

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

# May 22, 2008 4:40 PM

Rudolph said:

Thanks, worked fine.

# June 14, 2008 9:12 PM

Malay Thakershi said:

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

# September 19, 2008 1:46 AM

rüya tabiri said:

Thank you...

# November 25, 2008 9:44 AM

Abdul said:

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.

# March 27, 2009 9:03 PM

Andy said:

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

# May 1, 2009 3:59 PM

Tom Steel said:

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).

# May 7, 2009 5:00 AM

Eliyahu said:

Cleaning up ASP.NET temporary files worked for me

# May 11, 2009 5:25 PM

Simon Hodgetts said:

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

# May 16, 2009 10:58 PM

Jony said:

Thanks,it worked for me.

# June 11, 2009 1:38 PM

John said:

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

# June 29, 2009 5:37 PM

Flemgrem said:

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

brilliant!

# July 2, 2009 2:13 PM

Mukesh Chourasia said:

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

# August 6, 2009 12:57 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Please add 1 and 5 and type the answer here: