Target rules ModuleRule not working because bad namings

This in relation to

I was encountering the same bug

I was able to reproduce it repeatedly by first creating a
“StrategyGame” from template, default name, with default location (nothing changed)

Then I create another one without changing defaults, this time it defaults to name “StrategyGame2” and again StrategyGame2.uproject and so forth

The first one “StrategyGame” when hitting “Compile” compiles c++ code just fine.

However when I try to hit Compile in “StrategyGame2”

I get the error mentioned similiar to the post

Info Performing full C++ include scan (hot reloading a new target)
Info Creating makefile for hot reloading StrategyGame2 (no existing makefile)
Info ERROR: Couldn't find target rules file for target 'StrategyGame2' in rules assembly 'StrategyGame2ModuleRules, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
Info Location: C:\Users\namro\Documents\Unreal Projects\StrategyGame2\Intermediate\Build\BuildRules\StrategyGame2ModuleRules.dll
Info Target rules found:
Info     UE4Editor - C:\Program Files\Epic Games\4.10\Engine\Source\UE4Editor.Target.cs
Info     UE4Game - C:\Program Files\Epic Games\4.10\Engine\Source\UE4Game.Target.cs
Info     StrategyGame - C:\Users\namro\Documents\Unreal Projects\StrategyGame2\Source\StrategyGame.Target.cs
Info     StrategyGameEditor - C:\Users\namro\Documents\Unreal Projects\StrategyGame2\Source\StrategyGameEditor.Target.cs
Info 

if I go through all the files like Build files, Target files, and folders, and rename some things a bit(such as adding the “2” to the right place, because it is still looking for “StrategyGame” instead of “StrategyGame2”, I did manage to get it to correctly build right.

The relevant files changes. (I think I got them all)

StrategyGame.Build.cs
    public class StrategyGame2 : ModuleRules  // I added the "2"
    public StrategyGame2(TargetInfo Target)  // I added the "2"
StrategyGame2.Target.cs    // I added the "2"
    public class StrategyGame2Target : TargetRules // I added the "2"
    public StrategyGame2Target(TargetInfo Target) // I added the "2"

It appears like some kind of variables aren’t dynamic and need to reflect the project name, instead of the template’s original name? or perhaps the “2” is getting truncated in some kind of reflection system? Not sure.

There is the problem, how to repro it, and how to ‘temp’ work around fix it.

Not sure, but did you try changing the name in the .uproject (not just the name of the file but its content) ?

Hello,

I have been able to reproduce your issue, and have entered a bug report (UE-23988). Thank you for your report, and for providing a workaround.

Have a great day,

Sean Flint