This is almost the same issue — my rc.exe was taking a very long time and sometimes even getting stuck.
In my case, the fix worked by editing <PROJECT_DIR>\Saved\UnrealBuildTool\BuildConfiguration.xml
<?xml version="1.0" encoding="utf-8" ?>
<Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">
<BuildConfiguration>
<bAllowUBAExecutor>false</bAllowUBAExecutor>
</BuildConfiguration>
</Configuration>
By the way, I also tried modifying only the WindowsSdkVersion, but it didn’t work:
<WindowsPlatform>
<WindowsSdkVersion>10.0.22621.0</WindowsSdkVersion>
</WindowsPlatform>
I also tested adding the config to
%APPDATA%\Unreal Engine\UnrealBuildTool\BuildConfiguration.xml,
but that didn’t work either. It seems UE5 may be using some cached configuration.
Thx to everyone above for the helpful replies.