Icon defaulting to UE4 icon

In UE4, I set the “Game Icon” to my custom icon in Project Settings, and if I build from UE4 my application correctly receives this icon. However, when I build using windows command line tools (UnrealBuildTool.exe, RunUAT.bat BuildCookRun), it defaulst to the UE4 icon. The icon “WindowsNoEditor/[project_name].exe” is correctly my custom icon, but “WindowsNoEditor/[project_name]/Binaries/Win64/[project_name]-Win64-Shipping.exe” is the UE4 icon, which is what is used for the task bar and the window icon. There are a lot of answer hub topics on this, but none that address this issue in particular. Does anyone know a fix? Is anyone successfully setting an icon when using command line build tools?

edit I posted a solution down below, but its not marked as the answer because its a hack. But if you have a need to fix this issue, and don’t want to go looking in UE4 code for the problem, its a quick fix.

Hey Nantuk, have you tried the fix at the bottom of this answer hub post? It appears the Icon needs to be a .ico file and a Power of 2 resolution.

I have tried that method. To reiterate, the issue appears to be that somewhere in the command line build tools (vs the in-editor build tools), it misses the “Binaries/Win64/[project_name]-Win64-Shipping.exe” and doesn’t assign it my custom icon, though it assigns it fine for “[project_name].exe”.

I ended up solving this by using Resource Hacker, a tool that can change icons of executables. It can be invoked via command line, which I do in my build automation process. I won’t mark this as answer because its more of a hack.

Here is the command line call I make:

ResourceHacker.exe -script "pathToMyScript\rh_update_icon.txt"

Here is the script I use to get the job done:

//This script replaces all resources
  [FILENAMES]
  Exe=    "pathToProblemExe\problemExe.exe"
  SaveAs= "pathToProblemExe\problemExe.exe"
  Log=   "pathToMyLogFolder\rh_update_log.txt"
  [COMMANDS]
  -addoverwrite "PathToProject\Build\Windows\Application.ico" ICONGROUP,123,1033  //adding all the new resources

This works for me… PARTIALLY. The taskbar icon looks right, but the exe is a generic icon.

This has to be the single most frustrating part of development with UE. I cannot believe that this problem still exists after 8 years!!! WHAT THE HELL UNREAL???

Me to :joy: