4.27

Visual Studio 2019

This should work without hitches provided you install the correct workloads and components

Workloads:

  • Desktop development with C++
  • Game development with C++

Components:

  • .NET 4.5 targeting pack
  • .NET 4.6.2 targeting pack

If the build nags about other missing .NET things, install appropriate components.

Visual Studio 2022

This may or may not work

You will likely have an easier time with VS 2019. You will probably need the same workloads and components.

If you still want to use 2022:

  • RunUAT may try to do dumb things with the C# compiler, you can just call AutomationTool directly.
  • You may need to install “Builds Tools 2013” to get MSBuild version 12. You may need to install an older version of Roslyn compilers to add C# 6 support. You can do this via Visual Studio’s Package Manager console:
PM> Install-Package Microsoft.Net.Compilers -Version 1.3.2

If the build from it fails and it complains about VS2017, you can change the xml file to send your VS version as a parameter

<!-- Compile flags for Windows targets -->
<Property Name="VSCompilerArg" Value="-2017"/>
<Property Name="VSCompilerArg" Value="-2019" If="$(VS2019)"/>

Build script

Engine\Binaries\DotNET\AutomationTool.exe BuildGraph -Script="Engine\Build\InstalledEngineBuild.xml" -Target="Make Installed Build Win64" -set:HostPlatformOnly=true -set:WithDDC=false -set:VS2019=true

InstalledEngineBuild.xml can be used to create a “rocket” build, eg. standalone engine build for sharing to other dev team members.

Post-build setup

Once you have a build done, you need to register it so that you can switch a game project to it.

Add a registry key to HKEY_CURRENT_USER\SOFTWARE\Epic Games\Unreal Engine\Builds. The key should be a string, with name set to an identifier you want to associate with your build, such as “MyUE”. This is what gets written into the uproject file to identify the engine version. The value should be set to the path to the newly built engine.

Possible errors

  1. Make sure you’re logged in in visual studio, or you’ll get this error:
** For UE4Game-Win64-Development UE4Game.target ** For UE4Game-Win64-Shipping Module.NetworkPrediction.cpp BUILD FAILED: failed, retries not enabled: AutomationTool exiting with ExitCode=1 (Error_Unknown)
  1. It may also be caused by using a weird locale for non unicode compatible apps. If it persists, try changing it to english from region settings

  2. If you get issues, check for DLL files that are exactly 2MB in size. Delete them and rebuild. DLL compile can apparently sometimes produce these if the compilation crashes

  3. There may be a compiler bug related problem if using MSVC 2022. This can be worked around by disabling optimizations on the affected files, such as FIoStoreReaderImpl in IoStore.cpp. Wrap the class in PRAGMA_DISABLE_OPTIMIZATION and PRAGMA_ENABLE_OPTIMIZATION