Download

Project files won't generate after adding Unreal Dedicated Server template (server.target)

I am trying to create the server files for a packaged game that includes access to a dedicated server. I am using this guide: https://wiki.unrealengine.com/Dedicated_Server_Guide_(Windows_%26_Linux) and this template: https://wiki.unrealengine.com/Standalone_Dedicated_Server

I am stuck at section 5. Particularly this: “At this point you need to refresh your Visual Studio project using the editor. This is a critical step to get the Visual Studio project from recognizing the new Server Target file.”

I can not get the server.target file to Generate after I have added it into the project source folder.

-Generate Visual Studio Project Files gives me the following error:

UnrealBuildTool Exception: ERROR: Expecting to find a type to be declared in a target rules named ‘Liftedline_1ServerTarget’. This type must derive from the ‘TargetRules’ type defined by Unreal Build Tool.

(Another guy had a similar problem https://answers.unrealengine.com/questions/233276/error-when-trying-to-compile-dedicated-server-bina.html , I have tried those templates but the error persists and still can’t get VS to see those either. I have tried both with and without the extra build.target the guy in the post mentions).

-Re-builds, scans and solution explorer refresh don’t make VS recognize server.target file.

Any help would be greatly appreciated.

Note* My project file is on a different drive then my github compiled version of UE4. Server.target file is placed in Project File—>source

Thanks

server.target_error.png

The name of the public class in the <Projectname>Server.Target.cs file is expected to be <Projectname>ServerTarget and must derive from TargetRules. In your case the class is name GameServerTarget, therefore the UnrealBuildTool complains. Just change the name of the class (don’t forget to adjust the constructor accordingly) and you should be good to go. So in your case the class should be named Liftedline_1ServerTarget.

I get the same error:
Running E:/UnrealEngine-4.19/Engine/Binaries/DotNET/UnrealBuildTool.exe -projectfiles -project=“E:/Witches_and_Angels/Witches_and_Angels.uproject” -game -engine -progress
Discovering modules, targets and source code for project…
ERROR: UnrealBuildTool Exception: Expecting to find a type to be declared in a target rules named ‘Witches_And_AngelsServerTarget’. This type must derive from the ‘TargetRules’ type defined by Unreal Build Tool.

The content of my target file:

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

using UnrealBuildTool;
using System.Collections.Generic;

[SupportedPlatforms(UnrealPlatformClass.Server)]
public class Witches_and_AngelsServerTarget : TargetRules // Change this line as shown previously
{
public Witches_and_AngelsServerTarget(TargetInfo Target) : base(Target) // Change this line as shown previously
{
Type = TargetType.Server;
ExtraModuleNames.Add(“Witches_and_Angels”); // Change this line as shown previously
}
}

I built the engine from source without errors, started my built engine and made a new project. Generating visual studio files wasn’t a problem either.
Then I added the server.tartet.cs file (Witches_and_AngelsServer.Target.cs) , richt clicked on the project file, selected change version and clicked OK without changing anything.
That’s when I got the error above.

I got the same error with a project created with original version 4.20, then changed to either built 4.20 or built 4.19, even built the engines in different drives so engine and project are on the same drive.
When I leave out the server target file I don’t get any errors. (obviously, as the error states it’s from the server target file).

I used the content of a posted server target file for 4.18, since it doesn’t seem to be the same as 4.17. (assuming 4.19 and 4.20 would be the same too)

What do I have to do to make this work?

(visual studio 2017 comunity, windows SDK 8,1 and 10, running windows 10 home 64bit)

*** I used following tutorials with the same results…:
*** https://www.youtube.com/watch?v=94liD8Sfs8I
*** https://wiki.unrealengine.com/Dedica…dows_%26_Linux

When I actually try to build the project, the development editor builds without problems, but the development server gives the following 3 errors:

Error MSB3075 The command “E:\UnrealEngine-4.19\Engine\Build\BatchFiles\Build.bat Witches_and_Angels Win64 Development “E:\Witches_and_Angels\Witches_and_Angels.uproject” -WaitMutex -FromMsBuild” exited with code 5. Please verify that you have sufficient rights to run this command. Witches_and_Angels D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets 44
Error C4577 ‘noexcept’ used with no exception handling mode specified; termination on exception is not guaranteed. Specify /EHsc Witches_and_Angels D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\INCLUDE\vcruntime_new.h 67
Error UBT ERROR: Failed to produce item: E:\UnrealEngine-4.19\Engine\Plugins\Media\WmfMedia\Binaries\Win64\Witches_and_Angels-WmfMedia.lib Witches_and_Angels E:\Witches_and_Angels\Intermediate\ProjectFiles\UnrealBuildTool 1

When I run visual studio as administrator, the first error is resolved, but the following error occurs instead:

Error MSB3073 The command “E:\UnrealEngine-4.19\Engine\Build\BatchFiles\Rebuild.bat Witches_and_Angels Win64 Development “E:\Witches_and_Angels\Witches_and_Angels.uproject” -WaitMutex -FromMsBuild” exited with code -1. Witches_and_Angels D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets 49

When I use this code for the server target:

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

using UnrealBuildTool; using System.Collections.Generic;

public class Witches_and_AngelsServerTarget : TargetRules {

public Witches_and_AngelsServerTarget(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(“Witches_and_Angels”);
}

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 };
}

}

I get the following error messages:

ERROR: e:\Witches_and_Angels\Source\Witches_and_AngelsServer.Target.cs(17,17) : error CS0122: ‘UnrealBuildTool.UEBuildBinaryConfiguration’ is inaccessible due to its protection level
ERROR: e:\Witches_and_Angels\Source\Witches_and_AngelsServer.Target.cs(15,25) : error CS0051: Inconsistent accessibility: parameter type ‘ref System.Collections.Generic.List<UnrealBuildTool.UEBuildBinaryConfiguration>’ is less accessible than method ‘Witches_and_AngelsServerTarget.SetupBinaries(UnrealBuildTool.TargetInfo, ref System.Collections.Generic.List<UnrealBuildTool.UEBuildBinaryConfiguration>, ref System.Collections.Generic.List<string>)’
ERROR: UnrealBuildTool Exception: Unable to compile source files.

Following these instructions:

          https://answers.unrealengine.com/questions/718575/error-when-updating-to-418-generating-visual-studi.html

I actually didn’t get any errors, and was able to build the server without errors.
That does mean however that I almost completely stripped the server target file clean.

This is all that’s left:

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

using UnrealBuildTool; using System.Collections.Generic;

public class Witches_and_AngelsServerTarget : TargetRules {

public Witches_and_AngelsServerTarget(TargetInfo Target) : base (Target)
{
Type = TargetType.Server;
ExtraModuleNames.Add(“Witches_and_Angels”);
}
}

Is that right? Or will this give me problems later on?