Due to Microsoft removing access to older VS2022 Community versions and the MSVC v14.38 toolchain, this script provides a workaround for Blueprint-only projects that are unable to generate C++ project files or resolve compiler version errors.
⚠️ Important Limitation While this script successfully generates the project solution (.sln) and compiles the project, it DOES NOT fix the "New C++ Class" wizard within the Unreal Editor. The Editor will still likely fail to add classes due to strict version checks.Workaround: You must manually create new
.hand.cppfiles via your IDE (Visual Studio / Rider) and re-generate project files.
This section outlines mandatory fixes to ensure your project compiles successfully when using newer MSVC versions (v14.44+) with Unreal Engine 5.
- Ensure you have the latest MSVC v143 (Visual Studio 2022) toolchain installed via the Visual Studio Installer.
- If VS 2022 is already installed, open the Installer, select 'Modify', and verify that the newest MSVC v143 toolchain component is checked and installed.
You must apply these fixes directly to the engine files. Modify the following two files in your UE install directory (C:\Program Files\Epic Games\UE_5.3\...):
A. Fix Address Sanitizer Error (Prevents compilation halt on newer toolchains)
- File:
Engine\Source\Runtime\Core\Public\Experimental\ConcurrentLinearAllocator.h - Action: Find
__has_feature(address_sanitizer)(Line ~31) and replace with:#elif 0 //__has_feature(address_sanitizer)
B. Bypass Compiler Version Check (Allows compilation with VS 2026 / newer VS 2022 updates)
- File:
Engine\Source\Runtime\Core\Public\Windows\WindowsPlatformCompilerSetup.h - Action: Find the version check (Line ~14) and replace with:
#if defined(_MSC_VER) && _MSC_VER > 9999
If Unreal Build Tool (UBT) uses an incorrect toolchain, you must manually specify the exact MSVC version UBT should use.
-
Verify Installed Versions: Open CMD and execute this command to locate your installed MSVC toolchains (the full version number is contained in the output path):
"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -find VC\Tools\MSVC\**\bin\Hostx64\x64\cl.exe -
Configure UBT: Open (or create)
BuildConfiguration.xmlin the UBT config folder (%AppData%\Unreal Engine\UnrealBuildTool).- Action: Insert the full version number found in Step 1 into the configuration below:
<?xml version="1.0" encoding="utf-8" ?> <Configuration xmlns="[https://www.unrealengine.com/BuildConfiguration](https://www.unrealengine.com/BuildConfiguration)"> <WindowsPlatform> <CompilerVersion>14.44.35207</CompilerVersion> <ToolchainVersion>14.44.35207</ToolchainVersion> </WindowsPlatform> </Configuration>
The script handles the necessary file and configuration creation automatically:
- Auto-Detection: Finds the
.uprojectfile and derives the project name. - JSON Safety Check: Safely aborts if the
"Modules"field already exists to prevent project corruption. - Module Injection: If safe, it injects the necessary
"Modules"definition into the.uprojectfile. - Source Generation: Creates the complete
Source/folder structure and the 5 core module files:<Project>.Target.cs<Project>Editor.Target.cs<Project>.Build.cs<Project>.h<Project>.cpp
- Run Script: Place
SetupProject.batin your project's root folder (next to the.uprojectfile) and double-click it.- The script will perform the detection, injection, and file creation automatically.
- Generate Solution: After the script finishes, generate your Visual Studio solution (
.sln) as usual (e.g., right-click the.uprojectfile and select "Generate Visual Studio Project Files").
Ensure your file structure looks like this before running the script:
MyGame/ (Project Root)
├── SetupProject.bat <-- PLACE SCRIPT HERE
├── MyGame.uproject (Updated automatically)
└── Source/ (Generated automatically)
├── MyGame.Target.cs
├── MyGameEditor.Target.cs
└── MyGame/
├── MyGame.Build.cs
├── MyGame.h
└── MyGame.cpp