4.18.2 bug: visual studio can't clean or rebuild with editor open

There is a bug with 4.18.2 where doing a clean or rebuild in VS with the unreal editor open gives errors.

Cleaning gives this error:
1>EXEC : error : Unable to delete XXX (Access to the path ‘XXX’ is denied.)
========== Clean: 1 succeeded, 1 failed, 0 skipped ==========

Rebuilding gives this error:
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets(46,5): error MSB3073: The command ““C:\Program Files\Epic Games\UE_4.18\Engine\Build\BatchFiles\Rebuild.bat” AAAMyProjectsEditor Win64 Development “XXX” -waitmutex” exited with code -1.
========== Clean: 1 succeeded, 1 failed, 0 skipped ==========

I have done the following things in every possible order to attempt to remedy this to no avail:

  • Create a fresh C++ third person project
  • Verify 4.18.2 in launcher
  • Check for missing visual studio packages in the VS installer and repair VS
  • Delete intermediate, binaries, saved, and .sln in project directory, generate VS project files, let VS initialize project
  • Try all this in a different directory on my computer
  • Open VS and UE4 as administrator
  • Change editor preferences > source code to VS 2015 and VS 2017.

If launching VS by opening a script from the editor, the “Loading VS…” cookie appears and doesn’t go away.

Closing the editor makes visual studio instantly clean and rebuild perfectly. 4.17 and every other version work perfectly.

Hello,

We’ve recently made a switch to a new bug reporting method using a more structured form. Please visit the link below for more details and report the issue using the new Bug Submission Form. Feel free to continue to use this thread for community discussion around the issue.

https://forums.unrealengine.com/unreal-engine/announcements-and-releases/1410408-unreal-engine-bug-submission-form

Thanks