Generating project files from source on 5.7 with Visual Studio 2026

Issue

If, like me, you uninstalled VS 2022 after installing VS 2026, you’ll get the following error when generating project files or loading the Default.uprojectdirs file on Rider to launch the UE5 source project:

Visual Studio 2022 x64 must be installed in order to build this target.

Cause

UE 5.7 does recognize VS 2026 in its project generation just fine. However, the DatasmithMaxExporter plugin is overwriting the WindowsCompiler in its DatasmithMax2017.Target.cs file to VS 2022. As soon as file generation gets to that plugin, the UnrealBuildTool tries to setup compilation with VS 2022 and fails, cancelling the project file generation.

Fix

Open DatasmithMax2017.Target.cs and delete the lines setting WindowsPlatform.Compiler:

WindowsPlatform.Compiler = WindowsCompiler.Clang;
WindowsPlatform.Compiler = WindowsCompiler.VisualStudio2022;

After deleting those lines, starting at line 33, the file should look like this:

	if (!Directory.Exists(MaxSDKLocation))
	{
	}

	Console.WriteLine("Skipping " + MaxSDKLocation);
	AdditionalCompilerArguments += " -Xanalyzer,-isystem-after" + MaxSDKLocation;
}
else
{
	AdditionalCompilerArguments += " /Zc:referenceBinding- /Zc:strictStrings- /Zc:rvalueCast- /Zc:preprocessor-";
}

WindowsPlatform.bStrictConformanceMode = false;
WindowsPlatform.bStrictPreprocessorConformance = false;

Save it. Then try re-opening it on Rider or generating project files again and it works.

11 Likes

I did worry about breaking something when making that change. But no other .Target.cs or Build.cs files override the compiler like that. The only similar thing is another Datasmith file reading the current compiler to conditionally change its build behavior. So, I’m 99% confident this won’t break anything (can’t be 100% confident of anything in coding lol).

Had a project throw the same “VS 2022 must be installed” error. Turned out it had this in DefaultEngine.ini:

[/Script/WindowsTargetPlatform.WindowsTargetSettings]
Compiler=VisualStudio2022

Maybe it was set in the platform settings in the Project Settings? Idk, but deleting that Compiler line allowed project files to be generated for this project.

Follow me, for more ways of preventing you from working on your Unreal project in subtle ways that don’t give you any useful errors whatsoever!

Thank you very much for your help, which resolved my problem in a timely and accurate manner!

1 Like

Yes, I had a similar error “Visual Studio 2022 installation not found“ after updating to UE 5.7 because my editor was set to specifically target the VS 2022. Although it used to work before the update. My way was to open a blueprint only project in order to change this setting in the Editor Preferences → Source Code Editor to “Visual Studio”.

1 Like

helpful, thanks! I just changed 2022 to 2026 and it worked

1 Like

Thanks.

1 Like

Thanks for posting your solution! There may be a faster way to fix that case if we find the .ini file storing that setting for the editor in the engine source folder.

I don’t have it set on my engine source, but the variable controlled by that editor preference is USourceCodeAccessSettings::PreferredAccessor. It’s a Config UPROPERTY, stored in EditorSettings.ini files. It belongs to the SourceCodeAccess module. Therefore, this is probably what we’d find in one of those files, if that setting has been overridden in Editor Preferences:

[/Script/SourceCodeAccess.SourceCodeAccessSettings]
PreferredAccessor="VisualStudio2022"

Those files will be in:

  • [Engine Installation Folder]/Engine/Config/BaseEditorSettings.ini
  • [Engine Installation Folder]/Engine/Config/[Platform Name]/PlatformNameEditorSettings.ini