At random our developers encountered a "Cannot create/shadow copy 'XXX' when that file already exists." on their machines when starting up a web application. A few reloads and mumbling secret magic words usually made the error go away. Annoying anyway. It happened both in Visual Studio .NET 2005 and 2008.
So, googling for a solution I found suggestions like this and this. A single line in the web.config (under system.web) should cure the problem:
<hostingEnvironment shadowCopyBinAssemblies="false" />
Now don't stop reading! This cures the problem mentioned, however it produced another even worse problem: As the developers on the team got the latest version from our version control, they started having trouble building. Typically:
- Build the web project. No problems
- View the web project in the browser
- Make some changes in code and build again - build error:
It only happened for Visual Studio .NET 2005 users (but that is stil the majority in our team). Workarounds like restarting the local web server or deleting the dll manually worked for some, but not all. Rebuilding the entire solution worked, but in our 48 projects solution, this took way to long time on each build.
It took me some time to figure out that the web.config change was the cause - and still I would probably not be able to prove it in court. Maybe other characteristics in our solution played a part too (the error is a confirmed bug, see the Microsoft knowledge base). But removing the line from web.config cured the problem for everyone. Now we happily live with our occasional "Cannot create/shadow copy 'XXX' " errors ;-)
The final solution seems to be upgrading to Visual Studio .NET 2008 (where the bug seems to be fixed) and re-applying the web.config change!
No comments:
Post a Comment