ERROR: Visual Studio 2017 must be installed in order to build this target. HELP

Hello! I am facing one strange problem while using Visual Studio and Unreal Engine. When I want to create new C++ project in Unreal Engine, the error “Visual Studio 2017 must be installed” appears. However, I have already installed it (and many additional components for it), but the error still appears. Reinstalling didn’t work. I have been struggling with this problem for 2 weeks, but I didn’t find the solution. Do you know what can cause this error?

1 Like

Did you include the necessary C++ components when installing Visual Studio 2017? You need to include the Game Development for C++ component with Unreal Engine Installer checked.
See this tutorial.

Yes, Game Development for C++( + Unreal Engine Installer), Desktop Development, .NET Development included

Try checking the registry keys for your visual studio to make sure Unreal can detect your VS installation.
Otherwise, you can always try installing “UnrealVS” extension on your visual studio.

Thank you for respond, but I have already thried that. Changing the destination of Visual Studio in regedit fixed the problem only partly, the error still pops up.
About UnrealVS - I am really unlucky person. The installer doesn’t launch, I cannot install it.

Am I correct to assume you are using the Epic Games Launcher version of the engine? (I see -rocket parameter in the command which usually means launcher version)
Did you try with the source version of the engine?
Also, are you able to create a C++ project in Visual Studio at all?

Thank you very much for your time. I have tried everything, it didn’t help me.
However, reseting the PC solved the problem)

Could you give me the details of how you solved it?

What registry keys should be checked and what values should they have?

Could you give me the details of how you solved it? I have the same problem

1 Like

Ran into this on 4.26.2, while trying to package a plugin, and I fixed it by just installing Visual Studio 2017 with the Game Development with C++ workload. Packaging seemed to work fine after that.

1 Like

Solution!

you need to additionally pass parameter “-VS2019” in the runUAT.bat for building with Visual Studio 2019

Example: “C:\Program Files\Epic Games\UE_4.25\Engine\Build\BatchFiles\RunUAT.bat” BuildPlugin -Rocket -Plugin=\plugin.uplugin -TargetPlatforms=Win64 -Package=\out -VS2019

Source: Need VS 2017 to build plugins in 4.25? - Programming & Scripting - Unreal Engine Forums

2 Likes

Ok, but why installing multiple VS version …
UE documentation says:

| Unreal Engine Version | Visual Studio Version |
| 4.25 or Later | VS 2019 (Default) |

I ran into a similar problem just recently trying to add a C++ class to a 4.26.2 project. I had both VS 2017 and 2019 installed prior to this attempt. For some reason Unreal kept trying to use VS 2017 (though I didn’t realize this right away) to add the C++ class, which appeared to be working; however, when VS opened I kept receiving an error saying that it would be incompatible with the version of Unreal. That’s when I realized Unreal was using VS 2017 to create the class rather than VS 2019. I tried setting VS 2019 as the default compiler in the engine and that still didn’t work. I even tried uninstalling VS 2017, which completely prevented the engine from creating the C++ class and kept resulting in the same error the original poster here was getting. Nothing I tried worked. Then I went to work and tried the same thing, not realizing that I hadn’t yet installed Visual Studio on that machine and had just recently put a fresh install of 4.26.2 on it. The Epic Games launcher itself then said I needed Visual Studio 2019 installed in order to create a new C++ project. I pressed the button to launch the VS installer, followed the Unreal documentation to properly install VS 2019, and everything ended up working exactly as intended (with no mention at all of any need for VS 2017). I concluded that I must’ve had a setting or file that was tripping up Unreal Engine, so I returned home and completely uninstalled all versions of Visual Studio and all the Microsoft Visual C++ redistributables as well as my installation of 4.26.2 engine. I then reinstalled the 4.26.2 engine and recreated the steps I followed at work. After installing VS 2019, everything worked as intended at home as well. So under normal circumstances, this doesn’t appear to be a problem that many people are facing, hence the lack of support on the community forums. I guess the old IT adages apply here, first make sure the power’s on, then try turning it off then back on again, and if all else fails, uninstall and reinstall everything. Usually works every time. Hope this helps!

Change the build version in settings Screen capture - d32e7a5d84537020612279af3a5fff68 - Gyazo

1 Like

For anyone looking for a recommended way to solve this : I solved this problem by editing the unreal build configuration file. Unreal Engine uses this file to determine which version of Visual Studio to use for build etc… You can have multiple VS versions installed and point unreal engine to use a specific one. This is done by adding VisualStudioXXXX where XXXX is the year 2019, 2017, or 2022 or whichever in the XML file. I wrote a tutorial about it here : https://store.algosyntax.com/tutorials/unreal-engine/ue5-visual-studio-2019-must-be-installed-in-order-to-build-this-target/

1 Like

Thank you!! I have VS2022 installed with all the components listed in this thread, and finally -VS2019 parameter removed the VS2017 requirement. -VS2019 parameter works with VS2019 and newer. As I said, I have Vs2022 installed, and -VS2019 worked.

1 Like