internal static Profile LoadProfile(string targetFrameworkVersion, string targetFrameworkProfile, string profileDir) { try { List <SupportedFramework> frameworks = new List <SupportedFramework>(); foreach (string frameworkFile in Directory.GetFiles(Path.Combine(profileDir, "SupportedFrameworks"), "*.xml")) { XDocument doc = XDocument.Load(frameworkFile); frameworks.Add(new SupportedFramework(doc.Root)); } if (frameworks.Count == 0) { return(null); } string redistListFileName = Path.Combine(profileDir, "RedistList", "FrameworkList.xml"); var redistList = TargetFramework.ReadRedistList(redistListFileName); return(new Profile(targetFrameworkVersion, targetFrameworkProfile, frameworks, redistList)); } catch (XmlException) { return(null); } catch (IOException) { return(null); } catch (UnauthorizedAccessException) { return(null); } }