public async Task <ImmutableDictionary <string, ConfiguredProject>?> GetActiveConfiguredProjectsMapAsync() { ActiveConfiguredObjects <ConfiguredProject>?projects = await GetActiveConfiguredProjectsAsync(); if (projects == null || projects.Objects.Count == 0) { return(null); } var builder = PooledDictionary <string, ConfiguredProject> .GetInstance(); bool isCrossTargeting = projects.Objects.All(project => project.ProjectConfiguration.IsCrossTargeting()); if (isCrossTargeting) { foreach (ConfiguredProject project in projects.Objects) { string targetFramework = project.ProjectConfiguration.Dimensions[ConfigurationGeneral.TargetFrameworkProperty]; builder.Add(targetFramework, project); } } else { builder.Add(string.Empty, projects.Objects[0]); } return(builder.ToImmutableDictionaryAndFree()); }
public async Task <ActiveConfiguredObjects <ConfiguredProject>?> GetActiveConfiguredProjectsAsync() { ActiveConfiguredObjects <ProjectConfiguration>?configurations = await GetActiveProjectConfigurationsAsync(); if (configurations == null) { return(null); } ImmutableArray <ConfiguredProject> .Builder builder = ImmutableArray.CreateBuilder <ConfiguredProject>(configurations.Objects.Count); foreach (ProjectConfiguration configuration in configurations.Objects) { ConfiguredProject project = await _project.LoadConfiguredProjectAsync(configuration); builder.Add(project); } return(new ActiveConfiguredObjects <ConfiguredProject>(builder.MoveToImmutable(), configurations.DimensionNames)); }
public async Task <ActiveConfiguredObjects <ConfiguredProject> > GetActiveConfiguredProjectsAsync() { ActiveConfiguredObjects <ProjectConfiguration> configurations = await GetActiveProjectConfigurationsAsync().ConfigureAwait(false); if (configurations == null) { return(null); } var builder = ImmutableArray.CreateBuilder <ConfiguredProject>(configurations.Objects.Length); foreach (ProjectConfiguration configuration in configurations.Objects) { ConfiguredProject project = await _commonServices.Project.LoadConfiguredProjectAsync(configuration) .ConfigureAwait(false); builder.Add(project); } return(new ActiveConfiguredObjects <ConfiguredProject>(builder.MoveToImmutable(), configurations.DimensionNames)); }
public async Task <ImmutableDictionary <string, ConfiguredProject> > GetActiveConfiguredProjectsMapAsync() { ImmutableDictionary <string, ConfiguredProject> .Builder builder = ImmutableDictionary.CreateBuilder <string, ConfiguredProject>(); ActiveConfiguredObjects <ConfiguredProject> projects = await GetActiveConfiguredProjectsAsync(); bool isCrossTargeting = projects.Objects.All(project => project.ProjectConfiguration.IsCrossTargeting()); if (isCrossTargeting) { foreach (ConfiguredProject project in projects.Objects) { string targetFramework = project.ProjectConfiguration.Dimensions[ConfigurationGeneral.TargetFrameworkProperty]; builder.Add(targetFramework, project); } } else { builder.Add(string.Empty, projects.Objects[0]); } return(builder.ToImmutable()); }