Include game project in engine solution

I downloaded the engine source code and set everything up.
Also I added the ShooterGame so my UE4 folder now looks like this:

  • Engine
  • Samples
  • ShooterGame
  • Templates
  • GenerateProjectFiles.bat

When you now generate projects to get a UE4.sln solution, you will notice that your game (ShooterGame) is missing from the solution.

To achieve this, run the batch file with a parameter.

GenerateProjectFiles.bat -project=%~dp0ShooterGame\ShooterGame.uproject

The problem is now that when I want to build the game, I get the compile error. It seems like the build tool wants to create my own version of the editor, server, file server and so on.

Is there any way to have a working game project in my solution where the Debug, Development, DebugGame, Shipping and Test configuration works?

1>------ Build started: Project: ShooterGame, Configuration: Development_Game x64 ------
1>EXEC : warning : UnrealBuildTool found an Intermediate folder while looking for rules '-----\ThirdParty\UE4\Engine\Source\ShooterGame\Intermediate'.  It should only ever be searching under 'Source' folders -- an Intermediate folder is unexpected and will greatly decrease iteration times!
1>EXEC : error : Couldn't find target rules file for target 'ShooterGame' in rules assembly 'ShooterGameModuleRules, Version=, Culture=neutral, PublicKeyToken=null'.
1>  Location: ------\ThirdParty\UE4\Engine\Intermediate\Build\BuildRules\ShooterGameModuleRules.dll
1>  Target rules found:
1>  	UE4Client - ------\ThirdParty\UE4\Engine\Source\UE4Client.Target.cs
1>  	UE4Editor - ------\ThirdParty\UE4\Engine\Source\UE4Editor.Target.cs
1>  	UE4Game - ------\ThirdParty\UE4\Engine\Source\UE4Game.Target.cs
1>  	UE4Server - ------\ThirdParty\UE4\Engine\Source\UE4Server.Target.cs
1>  	BlankProgram - ------\ThirdParty\UE4\Engine\Source\Programs\BlankProgram\BlankProgram.Target.cs
1>  	CrashReportClient -------\ThirdParty\UE4\Engine\Source\Programs\CrashReporter\CrashReportClient\CrashReportClient.Target.cs
1>  	MinidumpDiagnostics - ------\ThirdParty\UE4\Engine\Source\Programs\CrashReporter\MinidumpDiagnostics\MinidumpDiagnostics.Target.cs
1>  	UnrealLaunchDaemon - ------\ThirdParty\UE4\Engine\Source\Programs\IOS\UnrealLaunchDaemon\UnrealLaunchDaemon.Target.cs
1>  	ShaderCompileWorker - ------\ThirdParty\UE4\Engine\Source\Programs\ShaderCompileWorker\ShaderCompileWorker.Target.cs
1>  	SlateViewer - ------\ThirdParty\UE4\Engine\Source\Programs\SlateViewer\SlateViewer.Target.cs
1>  	SymbolDebugger - ------\ThirdParty\UE4\Engine\Source\Programs\SymbolDebugger\SymbolDebugger.Target.cs
1>  	UnrealFileServer - ------\ThirdParty\UE4\Engine\Source\Programs\UnrealFileServer\UnrealFileServer.Target.cs
1>  	UnrealFrontend - ------\ThirdParty\UE4\Engine\Source\Programs\UnrealFrontend\UnrealFrontend.Target.cs
1>  	UnrealHeaderTool - ------\ThirdParty\UE4\Engine\Source\Programs\UnrealHeaderTool\UnrealHeaderTool.Target.cs
1>  	UnrealLightmass - ------\ThirdParty\UE4\Engine\Source\Programs\UnrealLightmass\UnrealLightmass.Target.cs
1>  	UnrealPak - ------\ThirdParty\UE4\Engine\Source\Programs\UnrealPak\UnrealPak.Target.cs
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command "..\..\Build\BatchFiles\Build.bat ShooterGame Win64 Development" exited with code -1.
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========

I don’t think you are supposed to put project folders in with the engine. I keep all mine separate.

Okay I found the solution. Here are all the steps:

Download the engine source code and the two required files:

Log in to git if you see an error.

Extract those to a folder somewhere. Then put your game project, for example ShooterGame in the same folder. You will end up with a folder which looks like this:

  • Engine
  • Samples
  • ShooterGame
  • Templates
  • GenerateProjectFiles.bat

Now create a text file in the same folder called GameProjects.uprojectdirs

Just put a single ‘.’ in there representing the current folder.

The Unreal build tool will search for ./AnyFolder/*.uproject

Now run the batch file like this: GenerateProjectFiles.bat -game

Now you should be ready to go. Keep in mind that you now use your game project as the startup one. Also for a cooked build your binaries are now in ShooterGame/Binaries.

And if you do not want the launcher to come up all the time, you can change this in Editor.cpp → UEditorEngine::InitEditor.

If you are hard up to having all of this in the same solution, you can always set up a new build configuration and tell Visual Studio to just ignore those other projects without much difficulty.

Each entry in the Project contexts box
in a solution configuration represents
a project in the solution. For every
combination of Active solution
configuration and Active solution
platform, you can set how each project
is used. (For more information about
solution platforms, see Understanding
Build Platforms.)


And you can also select the checkbox next to the project to toggle it in or out of the current configuration.

It actually works quite fine. Building Development Editor of your game builds the UE4Editor and the editor versions of your game project.

Hmm, this didn’t work for me. I get the following error:

D:\Documentos\GitHub\UnrealEngine>GenerateProjectFiles.bat -game
Setting up Unreal Engine 4 project files...
UnrealBuildTool Exception: ERROR: A valid game project was not found in the spec
ified location ()

GenerateProjectFiles ERROR: UnrealBuildTool was unable to generate project files

Press any key to continue . . .

GameProjects.uprojectdirs is to be edited and filled with a single dot, correct?

This is actually exactly how we do all our work here at Epic. All game projects live in the UE4 (or Unreal Engine) root folder. So it should be completely supported and functional.

This is my folder structure, if there’s anything wrong, let me know.


I’ve also tried the the following command, as described [here][2]:

GenerateProjectFiles.bat ShooterGame/ShooterGame.uproject -Game

but got this message:

UnrealBuildTool Exception: ERROR: Directory 'ShooterGame' is missing 'Source' folder.

There’s nothing missing in that folder…

Oh, nice. I didn’t even try that as I expected it wouldn’t work.

Now, before I spend 30 minutes compiling, can you tell me the difference between the configurations “Debug Editor” and “DebugGame Editor”?

I had the same issue while trying to follow the instructions in this thread. This is working for me: GenerateProjectFiles.bat -project=%~dp0ShooterGame\ShooterGame.uproject

If I do this, the project gets added to the UE4 solution file, and I don’t get any of the compiling errors mentioned above.

I wasn’t able to make it work by using the GameProjects.uprojectdirs with a ‘.’ inside the file and got the same error as you.

Woo got it to work. I can now explore the engine source while debugging, awesome!

Here’s what I had to do to get it working. After settings up UE source as per Epic’s instructions on GitHub, copy a project (e.g. ShooterGame) to the root. Now, create another .bat file with the contents:

GenerateProjectFiles.bat -project=%~dp0ShooterGame\ShooterGame.uproject

Create a file called Games.uprojectdirs with the content:


This is my folder structure, just to make it clear for newcomers.


I built it with the “Debug Editor” config.

Hey I figured out what the issue was that prevented the .uprojectdirs thing from working. You shouldn’t be specifying the “-game” parameter when the generate script is called. To summarize the steps are:

Copy your game(s) to the root of the engine folder.

Now it should look like:

  • Engine
  • Samples
  • ShooterGame
  • MyOtherGameProject
  • Templates
  • GenerateProjectFiles.bat

Create a text file in the same folder called UE4.uprojectdirs

Put a single ‘.’ in there representing the current folder.

The Unreal build tool will search for ./AnyFolder/*.uproject

Double click the batch file “GenerateProjectFiles.bat” to run it

You should now have your projects inside the UE4 solution :slight_smile:

For what it’s worth, I had the same problem (Couldn’t find target rules file…) when creating projects outside the standard folder (my documents/unreal projects/etc.).

Rather than forcibly add MyGame to UE4.sln, you can use the uprojectdirs file mentioned above and put it in your project folder, then rebuild project files by right clicking your MyGame.uproject and selecting “Generate Visual Studio Projects”. This will correctly generate the solution files so they point to the correct targets and you can compile.

So to recap:

  • Create Game.uprojectdirs textfile in the root of your project folder (e.g. /UnrealEngine/MyGame/)
  • Right click MyGame.uproject, and select “Generate Visual Studio Projects” context option
  • Open updated solution file
  • Profit