示例#1
0
        /// <summary>
        /// Creates a new <see cref="SolutionConfigurationPlatformsGlobalSection"/> with the <see cref="SolutionConfigurationPlatformsGlobalSection.SolutionFileGlobalSectionName"/> and <see cref="PreOrPostSolution.PreSolution"/>.
        /// </summary>
        public static SolutionConfigurationPlatformsGlobalSection New()
        {
            var output = new SolutionConfigurationPlatformsGlobalSection
            {
                Name = SolutionConfigurationPlatformsGlobalSection.SolutionFileGlobalSectionName,
                PreOrPostSolution = PreOrPostSolution.PreSolution,
            };

            return(output);
        }
        public static bool HasSolutionConfigurationPlatformsGlobalSection(this IEnumerable <ISolutionFileGlobalSection> globalSections, out SolutionConfigurationPlatformsGlobalSection solutionConfigurationPlatformsGlobalSection)
        {
            var output = globalSections.HasGlobalSectionByName(SolutionConfigurationPlatformsGlobalSection.SolutionFileGlobalSectionName, out solutionConfigurationPlatformsGlobalSection);

            return(output);
        }
        public static void AddProjectConfigurations(this ProjectConfigurationPlatformsGlobalSection projectConfigurationPlatforms, Guid projectGUID, SolutionConfigurationPlatformsGlobalSection solutionConfigurationPlatforms)
        {
            var indicators = new[]
            {
                ProjectConfigurationIndicator.ActiveCfg,
                ProjectConfigurationIndicator.Build0,
            };

            foreach (var solutionBuildConfigurationMapping in solutionConfigurationPlatforms.SolutionBuildConfigurationMappings)
            {
                var mappedSolutionBuildConfiguration = solutionBuildConfigurationMapping.SolutionBuildConfiguration.BuildConfiguration == BuildConfiguration.Debug
                    ? SolutionBuildConfiguration.DebugAnyCPU
                    : SolutionBuildConfiguration.ReleaseAnyCPU;

                foreach (var indicator in indicators)
                {
                    projectConfigurationPlatforms.ProjectBuildConfigurationMappings.Add(new ProjectBuildConfigurationMapping
                    {
                        ProjectGUID = projectGUID,
                        SolutionBuildConfiguration       = solutionBuildConfigurationMapping.SolutionBuildConfiguration,
                        MappedSolutionBuildConfiguration = mappedSolutionBuildConfiguration,
                        ProjectConfigurationIndicator    = indicator,
                    });
                }
            }
        }