diff --git a/ICSharpCode.Decompiler/Solution/SolutionCreator.cs b/ICSharpCode.Decompiler/Solution/SolutionCreator.cs index 1619ea8f1..7cb07c9d5 100644 --- a/ICSharpCode.Decompiler/Solution/SolutionCreator.cs +++ b/ICSharpCode.Decompiler/Solution/SolutionCreator.cs @@ -29,7 +29,7 @@ namespace ICSharpCode.Decompiler.Solution /// public static class SolutionCreator { - private static readonly XNamespace ProjectFileNamespace = XNamespace.Get("http://schemas.microsoft.com/developer/msbuild/2003"); + static readonly XNamespace ProjectFileNamespace = XNamespace.Get("http://schemas.microsoft.com/developer/msbuild/2003"); /// /// Writes a solution file to the specified . @@ -52,20 +52,22 @@ namespace ICSharpCode.Decompiler.Solution throw new ArgumentNullException(nameof(projects)); } - if (!projects.Any()) + var projectList = projects.ToList(); + + if (!projectList.Any()) { throw new InvalidOperationException("At least one project is expected."); } using (var writer = new StreamWriter(targetFile)) { - WriteSolutionFile(writer, projects, targetFile); + WriteSolutionFile(writer, projectList, targetFile); } - FixProjectReferences(projects); + FixProjectReferences(projectList); } - private static void WriteSolutionFile(TextWriter writer, IEnumerable projects, string solutionFilePath) + static void WriteSolutionFile(TextWriter writer, List projects, string solutionFilePath) { WriteHeader(writer); WriteProjects(writer, projects, solutionFilePath); @@ -90,7 +92,7 @@ namespace ICSharpCode.Decompiler.Solution writer.WriteLine("MinimumVisualStudioVersion = 10.0.40219.1"); } - private static void WriteProjects(TextWriter writer, IEnumerable projects, string solutionFilePath) + static void WriteProjects(TextWriter writer, List projects, string solutionFilePath) { foreach (var project in projects) { @@ -103,7 +105,7 @@ namespace ICSharpCode.Decompiler.Solution } } - private static IEnumerable WriteSolutionConfigurations(TextWriter writer, IEnumerable projects) + static List WriteSolutionConfigurations(TextWriter writer, List projects) { var platforms = projects.GroupBy(p => p.PlatformName).Select(g => g.Key).ToList(); @@ -125,10 +127,10 @@ namespace ICSharpCode.Decompiler.Solution return platforms; } - private static void WriteProjectConfigurations( + static void WriteProjectConfigurations( TextWriter writer, - IEnumerable projects, - IEnumerable solutionPlatforms) + List projects, + List solutionPlatforms) { writer.WriteLine("\tGlobalSection(ProjectConfigurationPlatforms) = postSolution"); @@ -152,9 +154,11 @@ namespace ICSharpCode.Decompiler.Solution writer.WriteLine("\tEndGlobalSection"); } - private static void FixProjectReferences(IEnumerable projects) + static void FixProjectReferences(List projects) { - var projectsMap = projects.ToDictionary(p => p.ProjectName, p => p); + var projectsMap = projects.ToDictionary( + p => p.ProjectName, + p => p); foreach (var project in projects) { @@ -192,7 +196,7 @@ namespace ICSharpCode.Decompiler.Solution } } - private static string GetRelativePath(string fromFilePath, string toFilePath) + static string GetRelativePath(string fromFilePath, string toFilePath) { Uri fromUri = new Uri(fromFilePath); Uri toUri = new Uri(toFilePath);