Beispiel #1
0
 public static AspNet5Sdk GetAspNet5Sdk(string rootPath)
 {
     AspNet5Sdk aspNetSdk;
     if (!TryGetAspNet5Sdk(rootPath, out aspNetSdk))
     {
         aspNetSdk = new AspNet5Sdk
         {
             Architecture = GetDefaultAspNet5RuntimeArchitecture()
         };
     }
     return aspNetSdk;
 }
Beispiel #2
0
 private static bool TryGetAspNet5Sdk(string rootPath, out AspNet5Sdk aspNetSdk)
 {
     aspNetSdk = null;
     var globalJson = Path.Combine(rootPath, "global.json");
     if (FileSystemHelpers.FileExists(globalJson))
     {
         var parsedGlobalJson = JObject.Parse(FileSystemHelpers.ReadAllText(globalJson));
         if (parsedGlobalJson["sdk"] != null)
         {
             aspNetSdk = parsedGlobalJson["sdk"].ToObject<AspNet5Sdk>();
             if (string.IsNullOrEmpty(aspNetSdk.Architecture))
             {
                 aspNetSdk.Architecture = GetDefaultAspNet5RuntimeArchitecture();
             }
             return true;
         }
     }
     return false;
 }
Beispiel #3
0
 private static bool TryGetAspNet5Sdk(string rootPath, IFileFinder fileFinder, out AspNet5Sdk aspNetSdk)
 {
     aspNetSdk = null;
     var globalJsonFiles = fileFinder.ListFiles(rootPath, SearchOption.AllDirectories, new[] { "*global.json" })
         .Where(path => Path.GetFileName(path).Equals("global.json", StringComparison.OrdinalIgnoreCase))
         .ToList();
     if (globalJsonFiles.Count == 1 && FileSystemHelpers.FileExists(globalJsonFiles.First()))
     {
         var parsedGlobalJson = JObject.Parse(FileSystemHelpers.ReadAllText(globalJsonFiles.First()));
         if (parsedGlobalJson["sdk"] != null)
         {
             aspNetSdk = parsedGlobalJson["sdk"].ToObject<AspNet5Sdk>();
             if (string.IsNullOrEmpty(aspNetSdk.Architecture))
             {
                 aspNetSdk.Architecture = GetDefaultAspNet5RuntimeArchitecture();
             }
             return true;
         }
     }
     return false;
 }