예제 #1
0
        private void GenerateSolutionFile(ICollection <Project> projects)
        {
            if (String.IsNullOrWhiteSpace(SolutionFileFullPath))
            {
                SolutionFileFullPath = Path.ChangeExtension(ProjectFullPath, ".sln");
            }

            Dictionary <string, Guid> customProjectTypeGuids = ParseCustomProjectTypeGuids();

            LogMessageHigh($"Generating Visual Studio solution \"{SolutionFileFullPath}\" ...");

            if (customProjectTypeGuids.Count > 0)
            {
                LogMessageLow("Custom Project Type GUIDs:");
                foreach (KeyValuePair <string, Guid> item in customProjectTypeGuids)
                {
                    LogMessageLow("  {0} = {1}", item.Key, item.Value);
                }
            }

            SlnFile solution = new SlnFile();

            solution.AddProjects(
                projects.Where(ShouldIncludeInSolution)
                .Select(p => SlnProject.FromProject(p, customProjectTypeGuids, p.FullPath == ProjectFullPath)));

            solution.AddSolutionItems(GetSolutionItems());

            solution.Save(SolutionFileFullPath, Folders);
        }