How can I get the current Project Path within the c# build files?

Found a solution to my problem!

There is a variable called ModuleDirectory defined in ModuleRules which gives you the source directory of the project. I just used that to get my root project folder.

edit:
To provide an example I used this in my projects ModuleRules.

public string ProjectRoot
{
    get
    {
           return System.IO.Path.GetFullPath(
               System.IO.Path.Combine(ModuleDirectory, "../../")
           );
    }
}
3 Likes