You cannot just"just" disable locking of executable/library files.
Doing so would break quite a few thingsHowever, because you might cause situations that the OS never expected.can (If the developers assumed that a situation is impossiblemove or rename in-use files, they might not have written any code to deal with itso make your build process move the existing DLL elsewhere and compile the new one in its place.)
It's very possible that they didn't add a hidden switch for it because various parts of the OS assume it'll always be on. For example, it could be that the filesystem code simply assumesexpects that there's always at least one link to a file (and therefore space can be freed immediately after deleting that last link) – so if you force it to delete an in-use file, it might result in various kinds of filesystem corruption, like two files using the same disk space.
( That said, The Old New Thing has once written that it actually wouldn't be hard to allow Linux-style file deletion in the WinNT kernel, and that they just haven't done so to avoid some compatibility issues. However, the point remains – you still don't know whether the OS has been prepared for that possibility or not.)
However, you can move or rename in-use files, so make your build process move the existing DLL elsewhere and compile the new one in its place.