UnrealBuildTool.dll gets deleted on project build

Created new empty C++ project using fresh install of 5.4.2, trying to build both in Rider and Visual Studio results in UnrealBuildTool.dll being deleted from Engine\Binaries\DotNET\UnrealBuildTool\ and compilation failing. Anyone having ideas or similar issues?

Same actions worked fine with 5.3.2

The full output:

Build started at 12:37…
1>------ Build started: Project: Fix54, Configuration: Development_Editor x64 ------
1>Using bundled DotNet SDK version: 6.0.302
1>Running UnrealBuildTool: dotnet “…..\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll” Fix54Editor Win64 Development -Project=“E:\ue4proj\Fix54\Fix54.uproject” -WaitMutex -FromMsBuild -architecture=x64
1>Unhandled exception. System.BadImageFormatException: Could not load file or assembly ‘E:\UE5\UE_5.4\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll’. The module was expected to contain an assembly manifest.
1>File name: ‘E:\UE5\UE_5.4\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll’
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.MakeFile.Targets(44,5): error MSB3073: The command “E:\UE5\UE_5.4\Engine\Build\BatchFiles\Build.bat Fix54Editor Win64 Development -Project=“E:\ue4proj\Fix54\Fix54.uproject” -WaitMutex -FromMsBuild -architecture=x64” exited with code -532462766.
1>Done building project “Fix54.vcxproj” – FAILED.