Includes using NuGet Package wont work?

Hi, yes…
The solution i’ve applied is:
1 - Create a dir inside “Source” called “ThirdDeps”
2 - Create a file named “ThirdPartyDeps.Build.cs” inside the dir.
This is the content of the file, now i dont use anymore, so maybe is outdated.



using System.IO;
using UnrealBuildTool;

public class ThirdPartyDeps : ModuleRules
{
    string GetPlatformString ()
    {
        return (Target.Platform == UnrealTargetPlatform.Win64) ? "x64" : "x32";
    }

    string GetRootPath()
    {
        return Path.GetFullPath(Path.Combine(ModuleDirectory, "../../"));
    }

    private void LoadBoost()
    {
        const string LibraryPath = "../packages/boost.1.71.0.0/lib/native/include";//Theoretically "NuGet packages" are inside 'packages' dir

        PublicIncludePaths.Add(LibraryPath);

        if ((Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Win32))
        {
            string PlatformString = GetPlatformString();
            string PackagesDir = GetRootPath() + "packages";
            string boostVersionInDir = "1_71";
            string visualStudioCompiler = "vc142";
            foreach (var d in System.IO.Directory.GetDirectories(PackagesDir))
            {
                var dirName = new System.IO.DirectoryInfo(d).Name;
                if (dirName == "boost.1.71.0.0")
                {
                    continue;
                }
                string] splittedString = dirName.Split('-');
                PublicAdditionalLibraries.Add(System.IO.Path.Combine(PackagesDir, dirName + "/lib/native", "lib" + splittedString[0] + "-" + visualStudioCompiler + "-mt-" + PlatformString + "-" + boostVersionInDir + ".lib"));
                PublicAdditionalLibraries.Add(System.IO.Path.Combine(PackagesDir, dirName + "/lib/native", "lib" + splittedString[0] + "-" + visualStudioCompiler + "-mt-gd-" + PlatformString + "-" + boostVersionInDir + ".lib"));
                // PublicAdditionalLibraries.Add(System.IO.Path.Combine(PackagesDir, dirName + "/lib/native", "lib" + splittedString[0] + "-" + visualStudioCompiler + "-mt-sgd-" + PlatformString + "-" + boostVersionInDir + ".lib"));
                // PublicAdditionalLibraries.Add(System.IO.Path.Combine(PackagesDir, dirName + "/lib/native", "lib" + splittedString[0] + "-" + visualStudioCompiler + "-mt-s-" + PlatformString + "-" + boostVersionInDir + ".lib"));
            }

            PublicDefinitions.Add(string.Format("WITH_BOOST_BINDING={0}", 1));

        }
    }

    private void LoadNetworkLib()
    {
        string LibraryPath = "../Source/NetworkLib";

        PublicIncludePaths.Add(LibraryPath);

        if ((Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Win32))
        {
            string PlatformString = GetPlatformString();
            string fullPlatformPath = GetRootPath() + GetPlatformString();
            string buildType = "Debug";
            if(System.IO.Directory.Exists(fullPlatformPath + "/Release") == true)
            {
                buildType = "Release";
            }            
            PublicAdditionalLibraries.Add(System.IO.Path.Combine(fullPlatformPath, buildType+"/NetworkLib.lib"));
        }
    }

    public ThirdPartyDeps(ReadOnlyTargetRules Target) : base(Target)
    {
        Type = ModuleType.External;                
    }
}


3 - After you go inside your “MyProject” dir(located inside “Source”)
4 - Add the index “ThirdPartyDeps” in your “MyProject.Build.cs” close to this line:



PublicDependencyModuleNames.AddRange(new string] { "Core", "CoreUObject", "Engine", "InputCore", "Http", "Json", "JsonUtilities", "ThirdPartyDeps" });


Hope it helps! :slight_smile: