Hello [mention removed],
Both approaches are valid but behave differently.
Using a separate target file per store works but the packaged .exe will always match the Target name. Renaming the executable manually is not recommended, due to the internal metadata in the rest of the project.
If you want to produce the same .exe name across all store builds, a better approach would be to use a single target that branches its behavior based on a parameter passed during build. Here’s an example for UE 5.5 (built from source):
`using UnrealBuildTool;
using System.Collections.Generic;
using EpicGames.Core;
using System;
public class MyGameTarget : TargetRules
{
public MyGameTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Game;
DefaultBuildSettings = BuildSettingsVersion.V5;
IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_5;
ExtraModuleNames.Add(“MyProject”);
string cmdLine = Environment.CommandLine.ToLowerInvariant();
bool bSteamBuild = cmdLine.Contains(“-steam”);
bool bEpicBuild = cmdLine.Contains(“-epic”);
if (bSteamBuild)
{
GlobalDefinitions.Add(“GAME_STORE=STEAM”);
}else if (bEpicBuild)
{
GlobalDefinitions.Add(“GAME_STORE=EPIC”);
}
}
}`This setup lets you configure store-specific behavior without changing the executable name, which will always be MyGame.exe in this case.
To pass the store argument, you can run the build through a .bat script like this (eg, BuildStoreTarget.bat)
`@echo off
REM === Store can be STEAM, EPIC, or leave empty for standalone
set STORE=%1
set ENGINE_DIR=D:\P4\5.5.4\Engine
set PROJECT_DIR=%cd%
set TARGET_NAME=MyGame
REM === Run the build
call “%ENGINE_DIR%\Build\BatchFiles\RunUAT.bat” BuildCookRun ^
-project=“%PROJECT_DIR%\MyProject.uproject” ^
-noP4 -platform=Win64 -clientconfig=Development ^
-target=%TARGET_NAME% -build -cook -stage -pak -%STORE% -archive ^
-archivedirectory=“%PROJECT_DIR%\Packaged%STORE%”`You can run it like this from the project root:
BuildStoreTarget.bat STEAM
Some key points:
- This. bat script should live next to your .uproject.
- Output will be packaged into Packaged/STEAM (or EPIC/, etc.)
- You can use GlobalDefinitions to pass macros into your C++ code and change behavior based on the store.
Please let me know if this information helps.
Best,
Francisco