How to choose what folder's a project's Build.cs files access for includes and dependencies?

I am working on a project that has several plugins with their own Build.cs files. I am having an issue where these Build.cs files can not find files that exist within the same source folder unless I provide an include path all the way from my C: drive. For example, in my AmbientConditionsPlugin.Build.cs file

  PublicIncludePaths.AddRange(
            new string[] {
                "AmbientConditionsPlugin/Public"
                // ... add public include paths required here ...
            }
            );

Gives the warning:Severity Code Description Project File Line Suppression State
Warning Referenced directory ‘C:\Program Files\Epic Games\UE_4.21\Engine\Source\AmbientConditionsPlugin\Public’ does not exist. ScenarioGenerator C:\Users\USR\Documents\Unreal Projects\Duplicate\PluginSimulatorExampleProject\Plugins\AmbientConditionsPlugin\Source\AmbientConditionsPlugin\AmbientConditionsPlugin.Build.cs 1

If instead I use

        PublicIncludePaths.AddRange(
            new string[] {
                "C:/Users/USR/Documents/Unreal Projects/Duplicate/PluginSimulatorExampleProject/Plugins/CameraSensorPlugin/Source/CameraSensorPlugin/Public"

            }
            );

the warning goes away. This functions fine as a workaround but doesn’t fix my underlying issue.

Additionally, when I try to list my other plugins as dependencies I get a warning that they’re not being found. For example, in the same AmbientConditionsPlugin.Build.cs file

PublicDependencyModuleNames.AddRange(
            new string[]
            {
                "Core",
                "ConfigurationPlugin"
              
            }
            );

gives the warning "Severity Code Description Project File Line Suppression State
Warning Warning: Plugin ‘AmbientConditionsPlugin’ does not list plugin ‘ConfigurationPlugin’ as a dependency, but module ‘AmbientConditionsPlugin’ depends on ‘ConfigurationPlugin’. ScenarioGenerator C:\Users\USR\Documents\Unreal Projects\Duplicate\PluginSimulatorExampleProject\Intermediate\ProjectFiles\UnrealBuildTool 1

How do I get these build files to search my project folders instead of defaulting to the UE4.21\Engine folder? I’ve tried updating the Include directories in the project properties, but it doesn’t seem to have any effect.

This project was originally developed on Linux and I am attempting to build it on Windows 10. My team members are able to successfully build this project on their Linux machines and use the simplified include paths detailed in my first code example (“AmbientConditionsPlugin/Public”).

1 Like

Just ran into the same issue. The error is misleading, it’s not in the build.cs at all.

Fixed by adding some stuff to your .uproject file:

"Plugins": [
	{
		"Name": "PluginThisOneDependsOn",
		"Enabled": true
	}
]