Visual Studio "exited with code 6" error message after backing up my project

This is a bit of a strange one. Just as some context, I have only just started coding with C++ on UE5 after working with Blueprints for a little over a year so I am quite new to coding with C++ in this context.

I fear that the reason why I am encountering this error is due to me manually copying and pasting my project’s files to a different file location rather than a (probably existing) more professional approach.

The error messages I am encountering are as follows:


I’ve tried several solutions to try and fix this issue:

  • Deleting my Intermediate, Binaries, and Saved Folders and selecting the “Generate Visual Studio project files” option
  • I would clean and rebuild my solution in visual studio but to no avail
  • try to just create a new C++ class but be met with the same error message

Strange thing is, I was able to make a C++ file to attach a perception system to my AI character’s head successfully before I backed up the file and it worked fine. And still, the code which I made for this perception system is still working properly even though it is giving me these errors in visual studio.

Does anyone have any ideas what may be causing this? I am open to giving any additional context if needed.

Thank you in advance!

Try deleting the .vs folder, Source folder and the .sln file, open up your .uproject file, create a new C++ class (while you’re doing that you can as well make it public), then close the editor, navigate to the newly generated Source folder, then into the folder with your project’s name under the Source folder, and there you can replace the Public & Private folders with the original ones. Now you should be able to build your project just fine :innocent:

Disclaimer: Always make sure to have a backup of your project before manually adjusting the project files!!!

Hello @VisAgilis!

So I’ve followed your directions to a tee but I still seem to be having the same kind of issue. I’ve removed the following folders:

  • .vs
  • .snl
  • Source

And then opened up the .uproject file and created a new C++ class. I closed Unreal and Visual studio and then replaced the original public/private folders from an older backup I have. After opening up my .uproject file, I still cannot go into my C++ class and select “build”.

I have also tried to just leave the new Source files that have been created when I make the C++ class, but still everything refuses to build. After doing a “Clear” and “Rebuild” in Visual Studio, I got the following error (Hopefully this helps narrow down what may be going on):


Thank you for trying to help me out @VisAgilis, please let me know if you know of any other possible ways to fix this issue.

:slight_smile:

1 Like

Could you try this:

Create a new blank project, open up your current project by clicking on the .uproject file, migrate your assets to the blank project, replace the Public & Private folders in the blank project’s Source folder with the ones in your current project, and build your project via the new project’s .sln file?

You can migrate your desired assets by right clicking on them, navigating to the Asset Actions section on the menu that pops up, and selecting the Migrate option. You can also right click on a folder to migrate the assets inside as a whole!


If that doesn’t work out, I also found this post, check it out: The type or namespace name "UnrealBuildTool" could not be found - #6 by 3dRaven

Hope these help! :blush:

@VisAgilis, thank you for getting back to me!

I have tried a variety of things to get UE5 to let me create a class but boy has it been fighting me :sweat_smile:

I’ve tried your approach with creating a new project and migrating my assets to the blank project as you suggested, but it gave me the same type of error. I looked into the link you provided for the other solution to hopefully fix the issue, but it also gave me the same results.

I’ve even opened up a completely blank project, created a C++ class for an actor, and feel that I’ve narrowed down that whatever Issue I’m encountering may just have to do with either Unreal Engine or Visual Studio as a whole. When creating a C++ Actor class and reviewing all the error messages/Errors, they end up looking like this:


Everywhere that these errors exist in the code are places which I have never seen nor touched before which is quite strange.

To try and fix this issue, I’ve done the following:

  • Verified all files for Unreal Engine 5.4 via the Epic Launcher
  • Rolled Visual Studio to a slightly older version (apparently newer versions can cause issues from what I found)
  • Created several new blank projects to try and get a C++ class working
  • verified that I have all necessary packages to code in C++ in visual Studio Installer

Still, nothing seemed to work. At the moment I’m just not sure what to try next. Everything else in Unreal engine works fine, I can run Blueprints and debug my game no problem as long as I don’t do anything related to C++ Classes.

Thank you again for all the assistance you have provided thus far. I feel we’re narrowing down what may be causing issues but I’m curious what ideas you may have to fix these issues.

Thank you again for all the help!

1 Like

recommended to have a look this video:
https://dev.epicgames.com/community/learning/talks-and-demos/R4km/unreal-engine-i-wish-i-learned-this-sooner-unreal-fest-2024

There are a couple of things you should check:

  • See if Visual Studio 2022 is set as the default IDE by navigating to Editor Preferences > General > Source Code in the editor

  • Make sure you have the Visual Studio Integration Tool plugin enabled in your project and it’s updated via Epic Launcher

  • Navigate to the home tab of VS and there you’ll see all the recommendations it has for you, which you can consider implementing

If the issue persists after these steps, you can try reinstalling both the engine and VS while keeping the backup(s) of your project somewhere safe!!!

(Though I doubt the issue is related to the engine so I recommend uninstalling VS first and reinstalling it by selecting everything you’ll need)

Hope these can be helpful :innocent:

Hello @VisAgilis!

I have checked and I do in fact have Visual Studio set to my General Source Code. Also, I have the Visual Studio Integration tool Plugin enabled:


And when you talk about the home tab of VS, I assume you are talking about this one correct? The only thing that Visual studio is giving me warnings about is the Naming convention Checker as well as the HLSL support:

Does this setup look okay to you as well?

I’m going to continue to try and debug this solution throughout the day. If I can’t get it to work, I guess I’ll have to go nuclear as you suggested haha. I’ll keep you updated how it ends up working out for me :smiley:

Thank you again for the continued help!

@tootzoe1, thank you for this reference as well! There were a couple of things here that I’d never seen before so that was pretty cool. Sadly I didn’t really see anything to help solve my issue but thank you for the suggestion.

Thanks guys

Okay @VisAgilis I just want to provide an update:

I really am running out of ideas over here :sweat_smile:

I’ve tried everything. Uninstalling and reinstalling both Visual Studio and UE5 (as well as verifying both of them too and giving them admin rights) but when I start up visual studio, I am haunted by these 4 error messages lol:


I just want to list a couple of things that I’ve noticed while trying to overcome this issue:

  • these 4 errors listed above are consistently showing up regardless of what I do
  • I’ve noticed that whenever building, rebuilding, or clearing in Visual Studio, I am receiving the message that there 1 skip and it’s always this same line of code:

    I’m not sure what these messages could mean, but if you would like me to provide any extra details please let me know and I’ll give them to you.

I’ve even consulted my good friend ChatGPT and even they don’t have a clear answer to this issues aside from “remove .vs, source, and binaries folder”

Thank you!

1 Like

Uh oh, I think I know what’s going on :no_mouth:

I was reading your previous posts and noticed this:

I think you’re trying to build your project while the .uproject file is open, is that it?

Hey, it’s been a while since we last heard from you @POTATOGAMER! Are there any updates on your issue?

Hey there @VisAgilis!

I want to apologize for the delayed response, I’ve been away from my computer for the past few days due to recovering from an eye surgery (everything is okay :slight_smile: )

But now that I’m back, I’ve gone back to try and pinpoint what may have been causing this issue and it seems that being uneducated on how Unreal interacts with Visual Studio was the culprit. This whole conversation, I was under the impression that when working on my project, I need to select the “Build” option when adding my coding changes to Unreal Engine 5. What I was not aware of, is that when pressing ctrl + alt + F11, Unreal engine 5 would sync my visual studio changes to UE5.

To test if this feature is working, I have coding the following logic to work as a “print string” node would:


And when simulating my game, I am successfully receiving this message, which makes me think that this logic is working correctly!

If you look in my first screenshot, I still see these error messages which is quite strange I feel, but now I know that any changes being made in Visual Studio are properly being transferred to UE5.

Does this look good on your end as well?

And thank you soo much for everything! It seems that your last reply asking if I’m trying to build my project while the .uproject file is open snapped me out of my trance lol.

Much appreciated :smiley:

1 Like

I’m so glad you’re OK, no need for apologies!


No problem! :smiling_face_with_three_hearts: It took some time to realize what was going on but hey, now you know all the troubleshooting steps for a typical VS related issue :rofl:

About the current error messages you’re encountering, they’re not related to your code so no need to worry :blush:

Here’s a post I found on it, check it out:

1 Like