I found it as a temporary solution when I was comparing different versions of the City Sample on UE 5.2 and UE 5.3 so I wasn’t having the exact awnser for this issue at that time.
But now I guess Epic Developers forgot to remove the target CitySampleCookedEditorTarget from City Sample when they released it to marketplace.
Because if you take a look at the output logs, you will find that the error from UnrealBuildTool is trigged by this condition:
if (Rules.BuildEnvironment == TargetBuildEnvironment.Unique && Unreal.IsEngineInstalled())
{
throw new BuildException("Targets with a unique build environment cannot be built with an installed engine.");
}
And this condition happened when the function SetDefaultsForCookedEditor(bIsCookedCooker: false, bIsForExternalUse: true); being called inside CitySampleCookedEditorTarget.
That’s what I can see so far.
Hope it help.