New Target.cs not showing up in Visual Studio

I have a project that is C++ and blueprints. It has the usual regular and Editor Target.cs files.

I added a new MyGameServer.Target.cs

I then regenerate the VS files. In Visual Studio 2013 the new Server build does not show up and the MyGameServer.Target.cs does not show in the solution explorer.

I tried putting a typo in the Server target cs file and it does cause an error so i know it is getting parsed.

Any ideas?

— More

I made a default C++ FirstPerson game project from the standard template. Then copied the MyProject.target.cs
to MyProjectServer.target.cs and edited it to be …

// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool;
using System.Collections.Generic;

public class MyProjectServerTarget : TargetRules
{
	public MyProjectServerTarget(TargetInfo Target)
	{
		Type = TargetType.Server;
	}

	//
	// TargetRules interface.
	//

	public override void SetupBinaries(
		TargetInfo Target,
		ref List<UEBuildBinaryConfiguration> OutBuildBinaryConfigurations,
		ref List<string> OutExtraModuleNames
		)
	{
		OutExtraModuleNames.Add("MyProject");
	}
}

Then regenerated the project files. The Server build mode does not show up in visual studio’s explorer nor as a build option…

Hi, It looks like you are missing some information:

// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
 
using UnrealBuildTool;
using System.Collections.Generic;
 
public class GameServerTarget : TargetRules
{
    public GameServerTarget(TargetInfo Target)
    {
        Type = TargetType.Server;
    }
 
    //
    // TargetRules interface.
    //
    public override void SetupBinaries(
        TargetInfo Target,
        ref List<UEBuildBinaryConfiguration> OutBuildBinaryConfigurations,
        ref List<string> OutExtraModuleNames
        )
    {
        base.SetupBinaries(Target, ref OutBuildBinaryConfigurations, ref OutExtraModuleNames);
        OutExtraModuleNames.Add("Game");
    }
 
    public override bool GetSupportedPlatforms(ref List<UnrealTargetPlatform> OutPlatforms)
    {
        // It is valid for only server platforms
        return UnrealBuildTool.UnrealBuildTool.GetAllServerPlatforms(ref OutPlatforms, false);
    }
 
    public override List<UnrealTargetPlatform> GUBP_GetPlatforms_MonolithicOnly(UnrealTargetPlatform HostPlatform)
    {
        if (HostPlatform == UnrealTargetPlatform.Mac)
        {
            return new List<UnrealTargetPlatform>();
        }
        return new List<UnrealTargetPlatform> { HostPlatform, UnrealTargetPlatform.Win32, UnrealTargetPlatform.Linux };
    }
 
    public override List<UnrealTargetConfiguration> GUBP_GetConfigs_MonolithicOnly(UnrealTargetPlatform HostPlatform, UnrealTargetPlatform Platform)
    {
        return new List<UnrealTargetConfiguration> { UnrealTargetConfiguration.Development };
    }
}

You can check out this information here:

Also extra help on dedicated servers I use is here:

Hope that helps!

I ended up fixing this by building the UE4 engine from the source. That appears to enable stand-alone server builds.

In VS, right click and select “Add” → “existing item”. Than select your new server target file.