A solution was to clean the solution (getting the same error),
waiting a few seconds, cleaning again,
and then building.
Now I found a solution that seems to work,
right click the project,
properties,
Build steps,
and add to the pre build command line :
if exist "$(TargetPath).locked" del "$(TargetPath).locked" if exist "$(TargetPath)" if not exist "$(TargetPath).locked" move "$(TargetPath)" "$(TargetPath).locked"
(You need to copy the double quotes too).
It might be needed to add this to more than one project in your solution, just look at the error you get when building.