How to change the name of target build?

Hi.
I wanna try to rename the name of the target. But when i add this line

public MyProject2Target(TargetInfo Target)
{
	Type = TargetType.Game;
    Name = "NewName";
}

to MyProject2Target() constructor of MyProject2.Target.cs the compiler couldn’t build project.

"Error	CS0103	The name 'Name' does not exist in the current context	\Source\MyProject2.Target.cs	"

Hello ,

You can change the name of the .exe that is output by changing the class names in the .target.cs.

As an example:

public class MyProjectTarget : TargetRules
{
	public MyProjectTarget(TargetInfo Target)
	{
		Type = TargetType.Game;
	}

would change to:

public class NewExecutableNameTarget : TargetRules
{
	public NewExecutableNameTarget(TargetInfo Target)
	{
		Type = TargetType.Game;
	}

and the new name would be NewExecutableName.exe

Hope this helps!

Thanks for your answer.
But i think when we change the name of the class and its constructor in .target.cs it couldn’t build.

What types of errors do you receive when trying to build after changing these class names? Did you also remove the line you added in your previous attempt to change the name?

We haven’t heard from you in a while, . Are you still having problems compiling the project after editing the .target.cs? If so, could you provide the list of errors as I mentioned in my last comment? In the meantime, I’ll be marking this issue as resolved for tracking purposes.

I’m so sorry. I’m a bit forgetful these days. When change the class name of build target to new name these 2 errors generated:

  1. Error MSB3073 The command ""D:\Epic

Games\4.10\Engine\Build\BatchFiles\Build.bat"
MyProject2 Win64 Development
“D:\Unreal
Projects\MyProject2\MyProject2.uproject”
-rocket -waitmutex -2015" exited with code -1. MyProject2 C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets 37

2.> Error Expecting to find a type to be

declared in a target rules named
‘MyProject2Target’. This type must
derive from the ‘TargetRules’ type
defined by Unreal Build
Tool. MyProject2 D:\Unreal
Projects\MyProject2\Intermediate\ProjectFiles\EXEC 1

Could you post the entire .target.cs file? It would be helpful to be able to take a look to ensure everything looks correct.

Absolutely yes.

// Fill out your copyright notice in the Description page of Project Settings.

using UnrealBuildTool;
using System.Collections.Generic;

public class FooTarget : TargetRules
{
	public FooTarget(TargetInfo Target)
	{
		Type = TargetType.Game;
    }

	//
	// TargetRules interface.
	//

	public override void SetupBinaries(
		TargetInfo Target,
		ref List<UEBuildBinaryConfiguration> OutBuildBinaryConfigurations,
		ref List<string> OutExtraModuleNames
		)
	{
		OutExtraModuleNames.AddRange( new string[] { "MyProject2" } );
	}
}

Hm, it looks correct. Is this something that you’ve only tried in your project or have you had a chance to try it in a new project? The reason I ask is because it’s possible that the existing code in the project is conflicting with these changes.Also, what build configuration are you using?

Win64, Development

Thank you for that. I apologize for the runaround where it seems like I’m trying to get you to try random things, but not being able the reproduce the issue is making it harder to debug this. With the new name in place, could you try doing a rebuild in the Development Editor configuration and see if that works for you?

I understand that you try to solve my problem. I have familiar with test scenarios and reverse engineering. So you can be relax with me. Take it easy dude! :slight_smile:

I have run the project under Win64 Development Editor. The Editor runs normally.

If that is the case, does that mean that the issue is resolved or is the editor not running correctly in a different configuration?

When i run the project under configuration of “Win64 Development Editor” the project runs with name “MyProject2 Editor” as i seen it before in splash screen. MyProject2 is previous name of the project. When i try to package the project under windows 64-bit the following error occurred:

UnrealBuildTool: ERROR: Couldn’t find target rules file for target ‘Foo’ in rules assembly ‘MyProject2ModuleRules, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null’.

I apologize for the delay. Changing the name of the splash screen upon startup can be done in the project settings under Description > About > Project Name.

As for the error, I looked it up and it seems like a common fix for it is to delete your Binaries and Intermediates folders, re-generate your project files, and then compile. It seems to be something to do with one of the old generated files that were based off the old name causing issues.

I changed the project name under Description > About > Project Name but nothing changed.

I have done these works:

  1. Delete intermediate, binary and .vs folders and *.sdf file in root directory of project.
  2. Change the name of the Project folder to Foo
  3. Change of every file that have named "MyProject2" to Foo
  4. Substitute everything that has name “MyProject2” to Foo in Source directory
  5. Change ProjectName in DefaultGame.ini Note: if you change the name of the game under Description > About > Project Name in editor, that doesn’t need to do this step.
  6. Open Foo.uproject with a text editor and substitute MyProject2 with Foo in modules section.
  7. Right click on the Foo.uproject and click generate visual studio project.
  8. Run Visual studio project and compile it.
  9. That’s done.

everything now smells with Foo! :slight_smile: