Browse Source

修改子配置文件的相对路径

陈国伟 4 years ago
parent
commit
7bf096ddb1
1 changed files with 4 additions and 2 deletions
  1. 4 2
      FastGithub/Program.cs

+ 4 - 2
FastGithub/Program.cs

@@ -34,10 +34,12 @@ namespace FastGithub
                 })
                 .ConfigureAppConfiguration(c =>
                 {
-                    if (Directory.Exists("appsettings") == true)
+                    const string APPSETTINGS = "appsettings";
+                    if (Directory.Exists(APPSETTINGS) == true)
                     {
-                        foreach (var jsonFile in Directory.GetFiles("appsettings", "appsettings.*.json"))
+                        foreach (var file in Directory.GetFiles(APPSETTINGS, "appsettings.*.json"))
                         {
+                            var jsonFile = Path.Combine(APPSETTINGS, Path.GetFileName(file));
                             c.AddJsonFile(jsonFile, true, true);
                         }
                     }