Corrupt Visual Studio solution

I’m using UE5 and vs2022. After trying to regenerate my project files, my c++ solution got corrupted. When I open the file explorer on Windows (Windows 10) and go in the folder containing my solution, File Explorer freezes and then closes on it’s own. Using command lines, I managed to erase the solution.

I tried to generate the project files using the context menu, but the option to generate them isn’t there. I tried using the version selector executable to solve this issue, but it didn’t work. Using the following command line (“D:\Epic Games\UE_5.4\Engine\Build\BatchFiles\Build.bat” -projectfiles -project=“D:\MyProject.uproject” -game -rocket -progress) I was able to generate the project solution. However, the newly generated solution file was corrupted as well. I reinstalled vs2022 and UE5, but the problem still occurred. I tried to create a new Unreal project, but the problem still occurred. I tried creating a C++ project using vs2022 and everything was fine.

UE5 generates corrupted .sln files, but not vs2022.

Does anyone know how to fix this.

Update 1:

Using the following command “Build.bat MyProjectEditor Win64 Development D:\Folder\containing\the\project\MyProject.uproject” I was able to generate the Binaries and Intermediate folders. I’m now able to open my project.

Unfortunately, I’m unable to generate the .sln file. I’ve check online on how to solve this issue. Some said to use the “Generate Project Files” option in the context menu, which isn’t there. Others said to use GenerateProjectFiles.bat, which I couldn’t find in the BatchFiles folder.

For the “Generate Project Files” option, people online said to launch UnrealVersionSelector.exe in the installation folder. It didn’t work.

For the GenerateProjectFiles.bat file, I tried to create it manually using one for UE4, but I quickly realized I have no idea how to adapt it to UE5.

This seems to be the answer to the problem.

Greetings @TechWiz540

Welcome to the Unreal Engine Community Forum. I was going to respond when I saw the original post. But, it seems like you may have made some progress on fixing it. Were you able to resolve it?

Mostly. I successfully generated the solution file. Still have one problem though. Before the problem occurred, I was trying to regenerate the vs project files. I added a header file with an enum, but Visual Studio couldn’t recognize anything related to to Unreal Engine. Couldn’t recognize UENUM or UMETA.

From what I saw online, I need to erase the Saved, Intermediate and Binaries folders and, from the uproject file’s context menu, select the “Generate Visual Studio project files” option. Problem is, the option isn’t there. I tried to use UnrealVersionSelector.exe to solve the issue, but it didn’t work (How to solve the lack of options such as Generate Visual Studio project files in the right-click menu in UE4 and UE5 | Pome). I tried to regenerate the the project’s files by using command lines, to no avail. This lead to the problem I mentioned in the first post.

Nevermind, I found the solution. (Missing 'Generate Visual Studio Project Files' in context menu - #23 by leandros_1)

Awesome! I’m glad you were able to get it fixed!