Can't generate project files (or even open project)

Hi! Whenever I try to generate project files (via right clicking the .uproject), I get the following error:

Running C:/Unreal Engine 4/4.10/Engine/Binaries/DotNET/UnrealBuildTool.exe  -projectfiles -project="C:/Users/jafca_000/Documents/Unreal Projects/TestGame/TestGame.uproject" -game -rocket -progress
Discovering modules, targets and source code for game...
Android debugging may not be available (requires Visual Studio max version of 2013, use '-2013' to override.)
Errors detected while compiling C:\Users\jafca_000\Documents\Unreal Projects\TestGame\Intermediate\Build\BuildRules\RocketUE4ModuleRules.dll:
c:\Users\jafca_000\Documents\Unreal Projects\TestGame\Intermediate\Source\TestGame.Target.cs(6,14) : error CS0101: The namespace '<global namespace>' already contains a definition for 'TestGameTarget'
UnrealBuildTool Exception: ERROR: UnrealBuildTool encountered an error while compiling source files

So far I’ve tried deleting the source/dotnet folders within the UE4 installation directory, reinstalling UE4, adding code from within the editor, deleting the source folder in the project directory, among others. Keep in mind that this is project-specific; I can generate project files fine for other projects. This used to be a blueprint-only project, but I’d like to start adding C++ code and be able to compile from within VS.

Also, I can’t seem to open the project from within the actual editor anymore. Whenever I try opening it, it says that “The following modules are missing or built with a different engine version: UE4Editor-TestGame.dll” and then it prompts me with “Would you like to rebuild them now?” If I select no, nothing happens. If I select yes, then it says “TestGame could not be compiled. Try rebuilding from source manually.”

Last thing to keep in mind is that this used to be an UE4 4.9 project that I converted to 4.10. It worked fine in 4.10 until I tried adding c++ code to it, however.

I’m at a loss here, I have no clue what to do. Thank you so much for your help!

I tried creating a new project and moving the files to it, but generating project files gives me the same exact error.

Hey paragonx9-

If you are using Visual Studio 2013 can you let me know if you have the same problem when using VS2015 instead? When you added code to the project did you do so though the editor’s New C++ Class option or did you add the class from inside VS itself? Can you open the project’s .sln file and build the solution inside Visual Studio?


Doug Wilson

Hi paragonx9,

We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will offer further assistance.

Thank you.

I had same issue with blueprint-only project when adding C++ classes. I believe there is name clash in generated namespace and your game content folder when you call it same name as project( e.g. having /Source/GameName and /Content/GameName = oops, global namespace already has GameName)
So either rename /Content/GameName folder to something else, or /Source/GameName and relevant headers and build target .cs files. Hope it helps.

In my case it was a file in Intermediate\Source. In there was a Target.cs file that was conflicting with the one in the C++ Source directory, It must be what is used for Blueprint-only. Deleting that got it all working again.

I finally solved this problem , i added new C++ class(eg:slate widget) instead of empty c++ class.

Officially tutorial told me that i should create empty c++ class. But this doesn’t works for me.

Hope this help for you .And tell me if this works.

This was the issue for me! After looking through countless of answers and forums (There aren’t that many actually) this was what solved it for me!


Deleting the file in intermediate/source worked for me too, many thanks!

This worked for me even in 4.19. Thank you so much!

Deleting the file also worked for me like boom after i read this comment i moved out the file to the desktop then retried boom just like that it worked, unrealprojects/yourprojectfolder/intermediate/source/.target.cs
delete or move it out

Absolute madlad. It worked for me on 4.19. Thanks so much!

Thanks a lot! Can’t believe I couldn’t find an answer to this anywhere else

Deleting the file worked for me as well! I was able to click on Regenerate and it worked this time!