Plugin UE4.20 build.cs fails with System.NullReferenceException

Hello, im currently having trouble getting a plugin to package for UE4.20. No trouble in 4.19…


// copyright notice

using System;
using System.IO;
using UnrealBuildTool;

public class SteamworksCustom : ModuleRules
    public SteamworksCustom(ReadOnlyTargetRules Target) : base(Target)
        /** Mark the current version of the Steam SDK */
        string SteamVersion = "v142";
        Type = ModuleType.External;

        //PublicDefinitions.Add("STEAM_SDK_VER_PATH_Custom=TEXT(\"Steam" + SteamVersion + "\")");

**        string ProjectDir = Target.ProjectFile.Directory.ToString(); // TODO only test. THIS LINE FAILS**

        string SdkBase = Target.ProjectFile.Directory.ToString() + "/Plugins/SteamWorkshopAccessor/Source/SteamworksCustom/Steam" + SteamVersion + "/sdk";
        if (!Directory.Exists(SdkBase))
            string Err = string.Format("steamworks SDK not found in {0}", SdkBase);
            throw new BuildException(Err);

        PublicIncludePaths.Add(SdkBase + "/public/steam");



 ERROR: Unable to instantiate module 'SteamworksCustom': **System.NullReferenceException:** Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
            bei SteamworksCustom..ctor(ReadOnlyTargetRules Target) in c:\Users\vr3\Desktop\Neuer Ordner\UnrealPluginBuilder\SteamWorkshopAccessor420\HostProject\Plugins\SteamWorkshopAccessor\Source\SteamworksCustom\** 18**.

The error basically says: “You are not calling that onto an object instance”. I’m calling a function on Target and Target is an object instance…

The code was packaging in UE4.19 and won’t let me package in UE4.20. A project compile in from VisualStudio is no issue, the value of line 18 is as expected.

If there is another way to build the include path, I’m fine with it. But how?

Bump, maybe heaven knows.

Edit: Was missing an update for 4.20. After installation the issue was fixed.