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.
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.
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….
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++)
Did you type it wrong? It should be:
if(Compiler == WindowsCompiler.VisualStudio2022 ll ToolChain == WindowsCompiler.VisualStudio2022)
{
Compiler = WindowsCompiler.VisualStudio2026;
ToolChain = WindowsCompiler.VisualStudio2026;
}