I can't open my project after adding C++ Class

I made a mistake:
I tried to create a C++ Class in a UE4 Project, without installing Visual Studio and “SDK windows”.
When I try to Open the file, it gave me this message:

“The following modules are missing or built with a different engine version:
My Project
Would you like to rebuild them now?”

I said yes:

“MyProject could not be compiled. Try rebuilding from source manually.” (I don’t know how to do that)

I tried to create a c++ class in a new project. Now It’s work and I can re-open the file.

But the first project is corrupted and I don’t know how to fix it. I tried many method I saw in forums but it’s doesn’t work for me. Someone know how to fix my project ?
Thanks

Did you also delete some of the
intermediate folders? Means these:
Intermediate, .vs, Binaries, Saved? So
basically keeping only the Config,
Content and Source folders and the
.uproject file?

Yes i did.

After doing this, you should run into
the issue “the following modules are
missing…” again when opening the
uproject file.

hum… that not very clear for me…I’m a noob with that kind of problem… It didn’t tell me what the “following modules” it’s talking about.

Once finished with that, do the
“Generate Visual Studio Project Files”
again. Now you should be able to open
the sln and rebuild. At least, this
was how I did recover a broken project

Finished with what ? I didn’t get it ^^
I tried to build all “my project” with visual studio but nothing change.
Thanks for giving your time

Did you try to right click on your uproject file and select “Generate Project files” from the context menu?

Yes, and I have the same message

Hi, did you install visual studio?


Try rebuilding from source manually." (I don’t know how to do that)

Open the project in visual studio, then build it.

Did you also delete some of the intermediate folders? Means these: Intermediate, .vs, Binaries, Saved? So basically keeping only the Config, Content and Source folders and the .uproject file?

After doing this, you should run into the issue “the following modules are missing…” again when opening the uproject file.

Once finished with that, do the “Generate Visual Studio Project Files” again. Now you should be able to open the sln and rebuild. At least, this was how I did recover a broken project.

Yes I did, I clicked on the Project.sln and then, I did Build the project

he tell me this

“1>------Start Build globale : Projet : MyProject, Configuration : Invalid Win32 ------
1>The selected platform/configuration is not valid for this target.
========== Build globale : 1 sucess, 0 fail, 0 ignored ==========”

(google translate^^)

“The selected platform is not valid” Well I don’t have much choice of selection in the “solution explorator” in VS

So I saved and then I retry to relanch Myproject but it’s the message “The following modules are missing etc”

Up please, i’m not comfortable with Visual Studio and fixing files. I need detailed instruction

I do not have any solution ready for this. What you might try, but that’s really very experimental and speculative:

Open the .uproject file in text editor and remove the content from your Modules section in the project - this could prevent the attempt to build the project at all…

As I said: backup everything before doing this, I did never try this on my own.

{
	"FileVersion": 3,
	"EngineAssociation": "4.XX",
	"Category": "XXXX",
	"Description": "",
	"Modules": [
		{
			"Name": "YourProjectName",
			"Type": "Runtime",
			"LoadingPhase": "Default",
			"AdditionalDependencies": [
				"Engine",
				"AIModule"
			]
		}
	],
	"Plugins": [
		{
			"Name": "RawInput",
			"Enabled": true
		}
	]
}

change it to

{
	"FileVersion": 3,
	"EngineAssociation": "4.XX",
	"Category": "XXXX",
	"Description": "",
	"Modules": "",
	"Plugins": [
		{
			"Name": "RawInput",
			"Enabled": true
		}
	]
}

or maybe even remove the modules section completely…

Have no more ideas than this, but if you at least could open your project, you will be able to migrate content into a new one and start adding C++ stuff there, having installed Visual Studio and DotNet SDK at that time.

I got same problem.
I solved the problem by install .NET.

.NET : .NET Downloads (Linux, macOS, and Windows)
Reference : 【UE5】Visual Studioプロジェクト作成しようとするとエラーが出るときの対処方法 - 武0武/blog

I had the same problem and the only way for me was deleting the .h and .cpp that I created.
Then I try to open the proyect, the missing modules message pop-up, I clicked Yes.
And my proyect Started like if nothing happend.

To find the .h and .cpp I used Visual Studio. I tried to Build the project but it gave me some syntaxis errors from the codes I need to delete. Then just click in the Header part of the code and select “open containing folder”. That leads you to the file or files.