Compile Project from Batch file?

Hello,

During the beta I was using the following command to compile my uproject outside of Visual Studios :

"C:\Rocket\Engine\Binaries\DotNET\UnrealBuildTool.exe" ExilEditor Win64 Development "C:\Rocket\Projects\Exil\Exil.uproject" -rocket

Now under the official version, I tried a similar command :

"C:\GitHub\UnrealEngine\Engine\Binaries\DotNET\UnrealBuildTool.exe" ExilEditor Win64 Development "V:\UE4Projects\Exil.uproject"

Unfortunately this command alone seems to not work anymore. I get the following error :

ERROR: Couldn't find target rules file for target 'ExilEditor' in rules assembly 'ExilEditorModuleRules, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
Location: V:\UE4Projects\Intermediate\Build\BuildRules\ExilEditorModuleRules.dll
Target rules found:
        UE4Client - C:\GitHub\UnrealEngine\Engine\Source\UE4Client.Target.cs
        UE4Editor - C:\GitHub\UnrealEngine\Engine\Source\UE4Editor.Target.cs
        UE4Game - C:\GitHub\UnrealEngine\Engine\Source\UE4Game.Target.cs
        UE4Server - C:\GitHub\UnrealEngine\Engine\Source\UE4Server.Target.cs
        BlankProgram - C:\GitHub\UnrealEngine\Engine\Source\Programs\BlankProgram\BlankProgram.Target.cs
        CrashReportClient - C:\GitHub\UnrealEngine\Engine\Source\Programs\CrashReporter\CrashReportClient\CrashReportClient.Target.cs
        MinidumpDiagnostics - C:\GitHub\UnrealEngine\Engine\Source\Programs\CrashReporter\MinidumpDiagnostics\MinidumpDiagnostics.Target.cs
        UnrealLaunchDaemon - C:\GitHub\UnrealEngine\Engine\Source\Programs\IOS\UnrealLaunchDaemon\UnrealLaunchDaemon.Target.cs
        ShaderCompileWorker - C:\GitHub\UnrealEngine\Engine\Source\Programs\ShaderCompileWorker\ShaderCompileWorker.Target.cs
        SlateViewer - C:\GitHub\UnrealEngine\Engine\Source\Programs\SlateViewer\SlateViewer.Target.cs
        SymbolDebugger - C:\GitHub\UnrealEngine\Engine\Source\Programs\SymbolDebugger\SymbolDebugger.Target.cs
        UnrealFileServer - C:\GitHub\UnrealEngine\Engine\Source\Programs\UnrealFileServer\UnrealFileServer.Target.cs
        UnrealFrontend - C:\GitHub\UnrealEngine\Engine\Source\Programs\UnrealFrontend\UnrealFrontend.Target.cs
        UnrealHeaderTool - C:\GitHub\UnrealEngine\Engine\Source\Programs\UnrealHeaderTool\UnrealHeaderTool.Target.cs
        UnrealLightmass - C:\GitHub\UnrealEngine\Engine\Source\Programs\UnrealLightmass\UnrealLightmass.Target.cs
        UnrealPak - C:\GitHub\UnrealEngine\Engine\Source\Programs\UnrealPak\UnrealPak.Target.cs

Any idea what to change/add to make the compilation doable outside Visual Studios ? I have no clues of what to do regarding this error message.

I’d try UE4Game instead of Development. If that doesn’t work, someone else may have the answer.

I would assume that something inside the *Target.cs or *.Build.cs files that control the unreal build tool has changed from beta to the current version.

Maybe there are differences between your ExilEditor.target.cs and the *Target.cs files that ship with the engine that indicate the error?

I tried, it doesn’t work. :\

So, I tried :

"C:\GitHub\UnrealEngine\Engine\Build\BatchFiles\Build.bat" UE4Game Win64 Development

This worked, it recompiled the full engine. So my thought here is that calling the UnrealBuildTool with a target that doesn’t exists locally produce an error. I have no idea why during the Rocket Beta it was working globally and not now anymore…

Or maybe it’s because I use the engine version I compiled myself ?

I included a batch file that does exactly this in the Notepad++ tutorial on the wiki.

From memory, you need to add “-rocket”.

I already tried, it has no effect. But thanks for the zip file, I will look into it.

So you did (in the first post).
My bad :frowning:

The only other thing I can think of is t try running the UnrealBuildTool from the Unreal Engine directory.
This is how I have it setup in the batch file:

echo Switching to Unreal Engine directory...
pushd "C:\Program Files\Unreal Engine\4.0"
echo Now in "%CD%"
if not exist .\Engine\Binaries\DotNET\UnrealBuildTool.exe goto Error_NoUnrealBuildTool
echo Running UnrealBuildTool...
.\Engine\Binaries\DotNET\UnrealBuildTool.exe %PROJECT_NAME%Editor Win64 Development "%PROJECT_DIR%\%PROJECT_FILE%" -rocket
popd
goto Check_Compile_Error

This definitely works with a the binary build of Unreal Engine 4.
Not sure if it will work with a custom build.
I’ll have to try it myself.
Converting this to a comment since it didn’t answer it for you (yet).

Please let me know how you get on with it.

I just tried that and it still doesn’t work. I switched to the binary build too just in case. I still get the same problem. It’s like the compiler can’t find my “ExilEditor.Target.cs” which is properly defined inside the “Intermediate\Build\BuildRules\ExilEditorModuleRulesSourceFiles.txt”. :\

Probably stating the obvious, but can you build a project based off one of the C++ templates?

I had to recreate my build target based off one of the a C++ templates to make things play nice.

Hi ,

It looks like the configurations and target setup has changed since your original command.

ExilEditor would now simply be; Exil
and Development should now be; Development_Editor

it may also be worth noting that Win64 may need updating with x64.

Hope this helps,
Terence

Still “nope” unfortunately. :frowning:

I copied the line from the NMake settings of my Visual Studios project, so I can’t see why I would have made a mistake like that (which was what Epic Games developers recommended me during the Beta). By the way, your suggestion doesn’t work, the configuration name is not recognized at all.

It does appear that your project files are stale. Since you upgraded have you had a chance to regenerate the project files. ExilEditor, unless you specifically named your project that, should not exist. instead you should have one project file for your game, and separate configurations.

In my case, I have

Solution ‘UE4’
->Engine
->->UE4

->Games
->->MyGame

and in configurations i have
Development
Development Client
Development Editor
Development Server

Does your setup resemble this?

Terence

Ah, please ignore my previous comment. I overlooked that you had Unreal Build Tool in your command.

I have just attempted to repro your issue on my end and found it was successful.

D:\GitHub\UnrealEngine\Engine\Binaries\DotNET>UnrealBuildTool.exe HurlGameEditor Win64 Development “D:\GitHub\UnrealEngine\HurlGame”
Target is up to date.

I’ll see if I can repro your issue another way.

Terence

I was just able to repro by altering the path of the uproject,

D:\GitHub\UnrealEngine\Engine\Binaries\DotNET>UnrealBuildTool.exe HurlGameEditor Win64 Development "D:\GitHub\UnrealEngine\HurlGame"
ERROR: Couldn’t find target rules file for target ‘HurlGameEditor’ in rules assembly ‘HurlGameEditorModuleRules, Version=0.0.0.0, Culture=neutral, PublicKeyToke
n=null’.
[…]

Vs

D:\GitHub\UnrealEngine\Engine\Binaries\DotNET>UnrealBuildTool.exe HurlGameEditor Win64 Development "D:\GitHub\UnrealEngine\HurlGame\HurlGame.uproject"
Target is up to date.

It may be worth verifying your uproject filepath:
“V:\UE4Projects\Exil.uproject”

Terence

Glad it’s sorted! :slight_smile:

Ho gosh, I feel so dumb right now. You are right, my path was wrong since the beginning. Hugh. >_>

This worked in my case:

"path\to\BatchFiles\Build.bat" "MyUProjectEditor" Win64 Development -WarningsAsErrors "path\to\MyUProject.uproject"

Note that you have to attach “Editor” suffix to first argument. The build.bat available in BatchFiles folder calles UnrealHeaderTool. Arguments must be in this exact order.