This is due to shadow copying. You can disable it like this: web.config:
hostingEnvironment shadowCopyBinAssemblies="false"
You can also use a workaround if the above settings do not work at all with the pre-build event:
if exist "$(TargetPath).locked.bak" del "$(TargetPath).locked.bak" if exist "$(TargetPath).bak" del "$(TargetPath).bak" if exist "$(TargetPath).locked" ren "$(TargetPath).locked" "$(TargetPath).locked.bak" if exist "$(TargetPath)" ren "$(TargetPath)" "$(TargetPath).bak"
You can completely disable the ShadowCopy service on Windows so that you do not have to set these values ββfor all solutions, but this will greatly disrupt the functionality, so I do not recommend it.
You can always use a custom script batch to trigger the postbuild event of the last project (in accordance with the build order), which will perform all copy operations (which I am using now).
source share