Visual Studio randomly rebuilding entire engine source (4-27)

I am at a loss, this has confounded me at least once a day for the past week. Every so often (and completely randomly) Visual Studio will decide it needs to rebuild the Engine, taking upwards of 2 hours. Usually it only takes 7 or 8 seconds to just compile the startup project.

I have Ctrl+Shift+B bound to the UnrealVS build startup project command, with command-line args for the project (UnrealVS.BuildStartupProject), which is the action I always take until I’m running the engine. Once running I usually use Live Encoding and just compile in the Unreal editor.

The setup:

  • Building UE4 Engine from source (4.27.1)
  • Visual Studio Community 2019 with the UnrealVS plugin
  • Generated project files, using the GenerateProjectFiles.bat
  • Game project adjacent to engine directory, like usual

The output when it gives up and does this is something like:

Build started...
------ Build started: Project: MyGame, Configuration: Development_Editor x64 ------
Using 'git status' to determine working set for adaptive non-unity build (D:\UnrealEngine).
Creating makefile for MyGameEditor (no existing makefile)
Building 42 actions with 24 processes...
  [1/42] SharedPCH.Core.ShadowErrors.cpp
  [2/42] PCH.Core.cpp
  [3/42] Module.Core.2_of_16.cpp
  [4/42] Module.Projects.cpp
  [5/42] PCH.CoreUObject.cpp
  [6/42] UnrealHeaderTool-Projects.lib
     Creating library D:\UnrealEngine\Engine\Intermediate\Build\Win64\UnrealHeaderTool\Development\Projects\UnrealHeaderTool-Projects.lib and object D:\UnrealEngine\Engine\Intermediate\Build\Win64\UnrealHeaderTool\Development\Projects\UnrealHeaderTool-Projects.exp
  [7/42] Module.Core.12_of_16.cpp
  [8/42] Module.Core.8_of_16.cpp
  [9/42] Module.Json.cpp
  [10/42] Module.Core.4_of_16.cpp
  [11/42] Module.CoreUObject.9_of_9.cpp
  [12/42] UnrealHeaderTool-Json.lib
     Creating library D:\UnrealEngine\Engine\Intermediate\Build\Win64\UnrealHeaderTool\Development\Json\UnrealHeaderTool-Json.lib and object D:\UnrealEngine\Engine\Intermediate\Build\Win64\UnrealHeaderTool\Development\Json\UnrealHeaderTool-Json.exp
  [13/42] Module.Core.3_of_16.cpp
  [14/42] Module.Core.11_of_16.cpp
  [15/42] Module.Core.5_of_16.cpp
  [16/42] Module.Core.7_of_16.cpp
  [17/42] Module.CoreUObject.6_of_9.cpp

...
...

  [41/42] UnrealHeaderTool-CoreUObject.dll
     Creating library D:\UnrealEngine\Engine\Intermediate\Build\Win64\UnrealHeaderTool\Development\CoreUObject\UnrealHeaderTool-CoreUObject.suppressed.lib and object D:\UnrealEngine\Engine\Intermediate\Build\Win64\UnrealHeaderTool\Development\CoreUObject\UnrealHeaderTool-CoreUObject.suppressed.exp
  [42/42] UnrealHeaderTool.target
Total time in Parallel executor: 31.03 seconds


Parsing headers for MyGameEditor
  Running UnrealHeaderTool "D:\UnrealEngine\MyGame\MyGame.uproject" "D:\UnrealEngine\MyGame\Intermediate\Build\Win64\MyGameEditor\Development\MyGameEditor.uhtmanifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -abslog="D:\UnrealEngine\Engine\Programs\UnrealBuildTool\Log_UHT.txt"
LogInit: Display: Loading text-based GConfig....
Reflection code generated for MyGameEditor in 3.276133 seconds
Parsing headers for ShaderCompileWorker
  Running UnrealHeaderTool ShaderCompileWorker "D:\UnrealEngine\Engine\Intermediate\Build\Win64\ShaderCompileWorker\Development\ShaderCompileWorker.uhtmanifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -abslog="D:\UnrealEngine\Engine\Programs\UnrealBuildTool\Log_UHT.txt"
LogInit: Display: Loading text-based GConfig....
Reflection code generated for ShaderCompileWorker in 0.3805134 seconds
Building MyGameEditor and ShaderCompileWorker...
Using Visual Studio 2019 14.29.30137 toolchain (C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133) and Windows 10.0.16299.0 SDK (C:\Program Files (x86)\Windows Kits\10).
Building 2527 actions with 24 processes...
  [1/2527] UE4Editor-DesktopPlatform.lib
     Creating library D:\UnrealEngine\Engine\Intermediate\Build\Win64\UE4Editor\Development\DesktopPlatform\UE4Editor-DesktopPlatform.lib and object D:\UnrealEngine\Engine\Intermediate\Build\Win64\UE4Editor\Development\DesktopPlatform\UE4Editor-DesktopPlatform.exp
  [2/2527] UE4Editor-RHI.lib
     Creating library D:\UnrealEngine\Engine\Intermediate\Build\Win64\UE4Editor\Development\RHI\UE4Editor-RHI.lib and object D:\UnrealEngine\Engine\Intermediate\Build\Win64\UE4Editor\Development\RHI\UE4Editor-RHI.exp
  [3/2527] UE4Editor-Projects.lib

...
...

  [202/2527] Module.Engine.gen.71_of_71.cpp
  [203/2527] Module.Engine.gen.13_of_71.cpp
  [204/2527] Module.Engine.30_of_50.cpp
  [205/2527] Module.Engine.43_of_50.cpp

... eventually completes approximately ~2.5 to 3.0 hours later.

I’ve seen a few threads similar to this, but haven’t found the answer. Anyone have any advice? Much appreciated!