From e020988b70fe28164dd2cff24207e8f495eb0524 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Tue, 21 Nov 2017 15:13:06 -0800 Subject: [PATCH] Ensure Configuration is set correctly during design-time builds --- build/tasks/AnalyzeBuildGraph.cs | 7 ++++++- build/tasks/ProjectModel/SolutionInfoFactory.cs | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/build/tasks/AnalyzeBuildGraph.cs b/build/tasks/AnalyzeBuildGraph.cs index 0490dca6d1..6cf5322473 100644 --- a/build/tasks/AnalyzeBuildGraph.cs +++ b/build/tasks/AnalyzeBuildGraph.cs @@ -61,7 +61,12 @@ namespace RepoTasks Log.LogMessage(MessageImportance.High, $"Beginning cross-repo analysis on {Solutions.Length} solutions. Hang tight..."); - var solutions = factory.Create(Solutions, props, _cts.Token); + if (!props.TryGetValue("Configuration", out var defaultConfig)) + { + defaultConfig = "Debug"; + } + + var solutions = factory.Create(Solutions, props, defaultConfig, _cts.Token); Log.LogMessage($"Found {solutions.Count} and {solutions.Sum(p => p.Projects.Count)} projects"); if (_cts.IsCancellationRequested) diff --git a/build/tasks/ProjectModel/SolutionInfoFactory.cs b/build/tasks/ProjectModel/SolutionInfoFactory.cs index 91de1c818c..4099399118 100644 --- a/build/tasks/ProjectModel/SolutionInfoFactory.cs +++ b/build/tasks/ProjectModel/SolutionInfoFactory.cs @@ -27,7 +27,7 @@ namespace RepoTasks.ProjectModel _buildEngine = buildEngine; } - public IReadOnlyList Create(IEnumerable solutionItems, IDictionary properties, CancellationToken ct) + public IReadOnlyList Create(IEnumerable solutionItems, IDictionary properties, string defaultConfig, CancellationToken ct) { var timer = Stopwatch.StartNew(); @@ -47,9 +47,9 @@ namespace RepoTasks.ProjectModel solutionProps[prop.Key] = prop.Value; } - if (solutionProps.TryGetValue("Configuration", out var configName)) + if (!solutionProps.TryGetValue("Configuration", out var configName)) { - solutionProps["Configuration"] = configName = "Debug"; + solutionProps["Configuration"] = configName = defaultConfig; } var key = $"SlnInfo:{solutionFile}:{configName}";