UE5 Visual Studio 2019 must be installed in order to build this target

UE5 Set visual studio for building

In this tutorial we discuss how to fix the visual studio XXXX must be installed error, why it occurs, and in which situations you are most likely to get the error. You may have just upgraded or downgraded either your Visual Studio version or your unreal engine version and got met with this error. The following steps will help you debug and troubleshoot what’s causing Unreal Engine not to find your installed Visual studio version 2017,2019,2022 or any future Visual Studio versions.

Full Solution Steps

Unreal Build Configuration

You need to open the unrealbuildconfiguration.xml to set the new version of Visual Studio. The fileĀ  can be located at one of the following locations

  • Engine/Saved/UnrealBuildTool/BuildConfiguration.xml
  • User Folder/AppData/Roaming/Unreal Engine / UnrealBuildTool/ BuildConfiguration.xml
  • My Documents/Unreal Engine/UnrealBuildTool/BuildConfiguration.xml

VCProjectFileGenerator Setting

Inside the XML file, you have to look for and change the value of the VCProjectFileGenerator to your required Visual Studio version. This is denoted by using the Year of the VC version. Here is what it should look like for VS 2022 :

				
					<VCProjectFileGenerator>
    <Version>VisualStudio2022</Version>
</VCProjectFileGenerator>

				
			

WindowsPlatform XML Setting

Still, inside the unreal buildconfiguration.xml file, you have to find and change the value of the WindowsPlatform to your required Visual Studio version. This is what it should look like for VS 2022 :

				
					<WindowsPlatform>
    <Compiler>VisualStudio2022</Compiler>
</WindowsPlatform>

				
			

Conclusion

If following the above steps doesn’t work, removing other buildconfiguration.xml files from the above path and only leaving 1 might help. That’s because unreal engine uses only one of these and it makes sense for just 1 to be available. You can delete the others and see if it helps.

You can read more about the unreal buildconfiguration.xml file here:

REFERENCE : https://docs.unrealengine.com/4.27/en-US/ProductionPipelines/BuildTools/UnrealBuildTool/BuildConfiguration/