|Unreal Engine 5.7 + Visual Studio 2026| Build Engine From Source

This is a quick and definitely dirty fix for anyone trying to build UE 5.7 (5.7.0-release Git Tag to be specific.) with Visual Studio 2026 on Windows 11.

For now I have found, that the GenerateProjectFiles.bat script does not work because the UnrealBuildTool gets Compiler and Toolchain versions from configuration files which ask for VisualStudio2022. If you only have Visual Studio 2026, then in a file called VCEnvironment.cs located at Engine/Source/Programs/UnrealBuildTool/Platform/Windows/VCEnvironment.cs simply add the lines as below. This way you can generate the engine’s project files with GenerateProjectFiles.bat.

1 Like

TLDR: This is for anyone getting the error, “Visual Studio 2022 x64 must be installed in order to build this target.“ while building the engine from source.

(post deleted by author)

thanks @8Zerocool8 ,

yes , I checked just now, re-assign the enum variable “Compiler” to “WindowsCompiler.VisualStudio2022” before this code:
( file:VCEnvironment.cs , line 520 )

WindowsPlatform.TryGetToolChainDir(….)

successfully generate project files, time to say goodbye to VisualStudio2022….

1 Like

Hi

I’m having a similar issue with Windows packaging requiring Visual Studio 2022, but I’m not trying to build the engine from source, I’m using the standard engine from the Epic Launcher.

I posted my question before finding your post. You can see that original post here (my apologies to the community for my messy posting).

I can find the VCEnvironment.cs file but I can find the exact section you refer to. I can see several places where there are references to VisualStudio2022, but I’m not confident about what I should do.

Helpful suggestions welcome (Might v2026 work without issues? Will I have to tinker with VCEnvironment.cs?)

I did think that I should backtrack from the very new UE5.7 and try UE5.6 instead. But I suspect I will have the same issue requiring Visual Studio 2022 and not be able to get it. Perhaps I need to wait for UE5.7.1 …

(For info: I will only ever be using Blueprints, not C++)

Bit the bullet and decided to just try v2026. Configured same as v2022. Packaging now OK.

1 Like

Oh nice, you found the culprit! Thanks for sharing the info :slightly_smiling_face:

(post deleted by author)

Did you type it wrong? It should be:
if(Compiler == WindowsCompiler.VisualStudio2022 ll ToolChain == WindowsCompiler.VisualStudio2022)
{
Compiler = WindowsCompiler.VisualStudio2026;
ToolChain = WindowsCompiler.VisualStudio2026;
}

Not be:
if(Compiler == WindowsCompiler.VisualStudio2022 ll ToolChain == WindowsCompiler.VisualStudio2022)
{
Compiler = WindowsCompiler.VisualStudio2026;
Compiler = WindowsCompiler.VisualStudio2026;
}

1 Like

Just one line is enough :

Compiler = WindowsCompiler.VisualStudio2026;
2 Likes

Yes, there is a typo in there. Thanks for spotting it. :slightly_smiling_face: