Compilation failed - UE4.23 preview with Chaos

Compilation error: ‘metahost.h’ not found.

I’ve been trying to compile the preview version for 4.23 from source (with Chaos enabled), and this error has been persistently occurring, looks like this is a quite common issue with the #include <metahost.h>
For me it was in the file SwarmInterface.cpp in \Engine\Source\Editor\SwarmInterface\Private\

I haven’t had any luck in solving this yet, first I redownloaded the repo and went through the setup process again, and the problem persisted.
Then I figured it might be as easy as adding the full path to the file (for me it is installed as a part of .NET SDK v4.6.2) so I tried it. That resulted in the following three errors:

E0147: declaration is incompatible with “NSwarm::FLogCategoryLogSwarmInterface NSwarm::LogSwarmInterface”

LNK1104 cannot open file ‘mscoree.lib’

MSB3075: The command “…\Build\BatchFiles\Build.bat -Target=“UE4Editor Win64 Development” -Target=“ShaderCompileWorker Win64 Development” -WaitMutex -FromMsBuild” exited with code 5. Please verify that you have sufficient rights to run this command.

I have no idea how to fix this, any suggestions?

spent the day struggling with this (in the new, official 4.23 release branch), then found the issue: the UE4 build tool is looking for .NET SDK v4.6.1 or v.4.6.

Snag one of those components (by modifying your installation of VS in the Visual Studio Installer) and you should be all set to recompile - it solved my identical issue.

can you tell me, how you exactly solved this problem? When i install the .NET SDK v4.6.1 in VS the error remains

All I did was add the 4.6.1 SDK and the 4.6.1 targeting pack. Not sure which one solved - I also currently have the 4.6 targeting pack. (I probably have too many of those!)

I tried that and got the same errors as before. However, I will mark your answer as correct regardless. I will be updating this thread if I manage to solve it.

That didn’t solve my problem either.

not sure why it’s not working - fwiw I’ve successfully repro’d this solution on two other machines running VS2019. Good luck!

I had the same error, but with the VisualStudio 2017 version instead of 2019 it worked fine

I tried both the 2017 and 2019 version, no change.

I finally got it to compile, these are the steps:

  1. Download the source code from GitHub as a ZIP archive file instead of using Git clone

  2. Unpack the ZIP, run Setup.bat, then GenerateProjectFiles.bat

  3. Open the solution (.sln) file in Visual Studio 2019

  4. Right-click on the project you’re trying to build (UE4), select properties, then navigate to “VC++ Directories”

  5. Find the options “Include directories” and “Library directories”, change both to “Inherit from parent or project defaults”

  1. Apply and build (rebuild to be safe)

This fixed all of my original problems, check the other answers on this thread if this does not work for you.

TL;DR: Download the source code as ZIP instead of using Git clone, check your VC++ Directories in VS.