Friday, May 20, 2011

Cannot create/shadow copy 'File Name' when that file already exists

Workarounds

Configure hostingEnvironment in Web.config

<system.web>
<hostingEnvironment
idleTimeout="120"
shutdownTimeout="30"
shadowCopyBinAssemblies="false" />
</system.web>

Add these lines in the pre-build event command line, which basically unlocks the DLL within Visual Studio.

IF EXIST $(TargetPath).LOCKED (del $(TargetPath).LOCKED)
ELSE (IF EXIST $(TargetPath) (move $(TargetPath) $(TargetPath).LOCKED))

No comments: