views:

817

answers:

2

I get this error repeatedly when developing ASP.Net applications:

  Cannot create/shadow copy 'XXXXX' when that file already exists

Where XXXXX is a random DLL. Typically the DLL is one of the DLLs from Microsoft's Enterprise Library, but it varies.

It's really random, and it's very frustrating. I will go hours without getting the error, and then get this error every 10-20 minutes.

I've seen several solutions. For instance, this question. I've tried using Clean Solution option, and I've also simply restarted my local IIS. However, it still occurs at the same random but persistent frequency.

I've also seen many people mention using this option in the config file:

<hostingEnvironment shadowCopyBinAssemblies="false" />

However, others have mentioned it being problematic, and it should definitely not be used in production.

So, should I just give up and try the shadowCopyBinAssemblies option? (And make sure not to copy this change to other environments.) Am I the only one who gets this issue that often?

Note: I am using Visual Studio 2008.

A: 

I was getting this issue frequently when working with an imported DLL which we created.

Attempts to stop is happening failed, and even introduced different problems, but whenever it occurred I would just do a rebuild solution and the problem would immediately disappear for that build.

Also, I haven't seen the problem since working on Visual Studio 2002. 2008 does not have this issue that I know of, neither does 2005. Are you using an older VS?

CRice
I'm using Visual Studio 2008
david.mchonechase
ok, nothing to do with version then. If you do a rebuild solution does your application run?
CRice
Yes, I "clean" the solution, rebuild, and work for 10-20 minutes. Then I get the error again and repeat.
david.mchonechase
I got the same issue while working with DotNetNuke. It disappeared magically after fixing a wrong PortalAlias. Strange things happens. As an alternative to the hostingenviroment setting: Add this to the Pre-Build event command line: IF EXIST $(TargetPath).LOCKED (del $(TargetPath).LOCKED) ELSE (IF EXIST $(TargetPath) (move $(TargetPath) $(TargetPath).LOCKED))
AlejandroR
+3  A: 

Hi, have you taken a look at this link? http://www.connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=227522

It provides some workarounds on this issue.

daxsorbito