diff --git a/Applications/CLI/ogs.cpp b/Applications/CLI/ogs.cpp
index 3c93f6946fbb0a62351a309e18b7598469751dc0..41822e0c0b842e5b5d31e2ba1c9984a7bec3b535 100644
--- a/Applications/CLI/ogs.cpp
+++ b/Applications/CLI/ogs.cpp
@@ -45,6 +45,7 @@
 #include "InfoLib/GitInfo.h"
 #include "NumLib/NumericsConfig.h"
 #include "ProcessLib/TimeLoop.h"
+#include "filesystem.h"
 
 #ifdef OGS_USE_PYTHON
 #include "ogs_embedded_python.h"
@@ -193,6 +194,7 @@ int main(int argc, char* argv[])
 
             std::string prj_file = project_arg.getValue();
             auto patch_files = xml_patch_files.getValue();
+            std::string includepath = "";
             if (BaseLib::getFileExtension(prj_file) == ".xml")
             {
                 if (!patch_files.empty())
@@ -223,6 +225,8 @@ int main(int argc, char* argv[])
 
             if (!patch_files.empty())
             {
+                includepath =
+                    fs::canonical(fs::path(prj_file)).parent_path().string();
                 std::string current_prj_file = prj_file;
                 std::string current_prj_file_base =
                     BaseLib::extractBaseNameWithoutExtension(current_prj_file);
@@ -290,8 +294,9 @@ int main(int argc, char* argv[])
                 prj_file = project_arg.getValue();
             }
 
-            auto project_config = BaseLib::makeConfigTree(
-                prj_file, !nonfatal_arg.getValue(), "OpenGeoSysProject");
+            auto project_config =
+                BaseLib::makeConfigTree(prj_file, !nonfatal_arg.getValue(),
+                                        "OpenGeoSysProject", includepath);
 
             BaseLib::setProjectDirectory(
                 BaseLib::extractPath(project_arg.getValue()));
diff --git a/BaseLib/ConfigTreeUtil.cpp b/BaseLib/ConfigTreeUtil.cpp
index 55f31d2eb5c53380521bec26400107d5391376f4..b4596d03868b3c05544d4226d9d43d3a31a6bb0a 100644
--- a/BaseLib/ConfigTreeUtil.cpp
+++ b/BaseLib/ConfigTreeUtil.cpp
@@ -111,7 +111,8 @@ void replace_includes(
 
 ConfigTreeTopLevel makeConfigTree(const std::string& filepath,
                                   const bool be_ruthless,
-                                  const std::string& toplevel_tag)
+                                  const std::string& toplevel_tag,
+                                  std::string includepath)
 {
     ConfigTree::PTree ptree;
 
@@ -125,7 +126,11 @@ ConfigTreeTopLevel makeConfigTree(const std::string& filepath,
 
         if (toplevel_tag == "OpenGeoSysProject")
         {
-            traverse(ptree, fs::path(filepath).parent_path(), replace_includes);
+            if (includepath == "")
+            {
+                includepath = fs::path(filepath).parent_path().string();
+            }
+            traverse(ptree, fs::path(includepath), replace_includes);
         }
     }
     catch (boost::property_tree::xml_parser_error const& e)
diff --git a/BaseLib/ConfigTreeUtil.h b/BaseLib/ConfigTreeUtil.h
index 0014e5ff9f20a179a6d5105bb6df411ec2c5e49d..cea72aae960aee5085ee8ee40d60163dc7a4fa89 100644
--- a/BaseLib/ConfigTreeUtil.h
+++ b/BaseLib/ConfigTreeUtil.h
@@ -69,6 +69,7 @@ private:
  * \param be_ruthless  see ConfigTreeTopLevel::ConfigTreeTopLevel()
  * \param toplevel_tag name of the outermost tag in the XML file. The returned ConfigTree is rooted
  *                     one level below that tag.
+ * \param includepath  optional path in which relative include file path will be resolved.
  *
  * The parameter \c toplevel_tag is provided for compatibility with our existing configuration
  * files whose toplevel tags are written in camel case, which conflicts with the naming rules of
@@ -87,6 +88,6 @@ private:
  */
 ConfigTreeTopLevel
 makeConfigTree(std::string const& filepath, bool const be_ruthless,
-               std::string const& toplevel_tag);
+               std::string const& toplevel_tag, std::string includepath = "");
 
 }  // namespace BaseLib