UE 4.26.1 GenerateProjectFiles.bat unable to find platform.winmd

I want to build UE 4.26.1 myself, but after cloning the repository and running Setup.bat successfully I get stuck with GenerateProjectFiles.bat outputing the following error, on which I am unable to find any information about on the internet:

Setting up Unreal Engine 4 project files...
Binding IntelliSense data... 100%
Writing project files... 94%
ERROR: Unable to find platform.winmd for Visual Studio 2019 toolchain; 'Latest' is an invalid version

GenerateProjectFiles ERROR: UnrealBuildTool was unable to generate project files.

Here is some information which might be helpful:

OS: Windows 10 21H2

Installed Visual Studio Versions:

  • Visual Studio Community 2019
  • Visual Studio Community 2022

Installed Windows SDKs:

  • Windows Software Development Kit - Windows 10.0.19041.685 ← SDK installed with VS 2019, rest is VS 2022
  • Windows Software Development Kit - Windows 10.0.22000.194
  • Windows Software Development Kit - Windows 10.0.22000.832

Hey @F-BlockL!

Just to cover all bases, you are saying you have the Universal Windows Platform Development module installed in Visual Studios? See the following document for more information:

Have you tried reinstalling or updating VS 2019?

One day later and I found a fix to this obscure issue.

Turns out that the Unreal Build Tool which comes with UE 4.26.1 always uses Visual Studio 2022 install folder, even though 2019 is specified, which should be used automatically even without manually specifying so.

There seem to be two possible fixes:

  1. Temporarally move your Visual Studio 2022 install to another location
  2. Install the ‘Game developement with C++’ workload for Visual Studio 2022 as well

The reason why this issue has not come up for anyone before is that most people, including the ones I asked for help with this problem privately, have the ‘Game developement with C++’ workload installed with Visual Studio 2022 as well. So even though it also uses the wrong VS install, it still ends up finding the platform.winmd.

I Just update it using a hardcoding visual studio path:

open and edit GetMSBuildPath.bat:
“E:\git\Engine\Build\BatchFiles\GetMSBuildPath.bat”

set MSBUILD_EXE=“C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\amd64\MSBuild.exe”
goto Succeeded

then try to remove Hololens, using vscode open folder “\Engine\Source\Programs\UnrealBuildTool”

search Hololens in vscode, remove all relatetive to Hololens:
UnrealBuildTool.csproj line:290
TargetRule.cs 1512
VCProject.cs 843
ModuleRule. 1287