Skip to content

ryanwang0521/UE5_VS_Compatibility_Workaround

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

UE5 & VS2022/2026 Compatibility Workaround

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 .h and .cpp files via your IDE (Visual Studio / Rider) and re-generate project files.


⚠️ Critical: Fix VS 2022/2026 Compatibility

This section outlines mandatory fixes to ensure your project compiles successfully when using newer MSVC versions (v14.44+) with Unreal Engine 5.

1. Prerequisite & Toolchain Installation 🔧

  1. Ensure you have the latest MSVC v143 (Visual Studio 2022) toolchain installed via the Visual Studio Installer.
  2. If VS 2022 is already installed, open the Installer, select 'Modify', and verify that the newest MSVC v143 toolchain component is checked and installed.

2. Patch Engine Source Code 🩹

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

3. Verify and Configure MSVC Version ⚙️

If Unreal Build Tool (UBT) uses an incorrect toolchain, you must manually specify the exact MSVC version UBT should use.

  1. 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
  2. Configure UBT: Open (or create) BuildConfiguration.xml in 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>

🚀 Script Features

The script handles the necessary file and configuration creation automatically:

  • Auto-Detection: Finds the .uproject file 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 .uproject file.
  • 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

🛠️ How to Use

  1. Run Script: Place SetupProject.bat in your project's root folder (next to the .uproject file) and double-click it.
    • The script will perform the detection, injection, and file creation automatically.
  2. Generate Solution: After the script finishes, generate your Visual Studio solution (.sln) as usual (e.g., right-click the .uproject file and select "Generate Visual Studio Project Files").

📂 Output Structure

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors