Ensure Configuration is set correctly during design-time builds

This commit is contained in:
Nate McMaster 2017-11-21 15:13:06 -08:00
parent b05ec85f35
commit e020988b70
2 changed files with 9 additions and 4 deletions

View File

@ -61,7 +61,12 @@ namespace RepoTasks
Log.LogMessage(MessageImportance.High, $"Beginning cross-repo analysis on {Solutions.Length} solutions. Hang tight..."); 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"); Log.LogMessage($"Found {solutions.Count} and {solutions.Sum(p => p.Projects.Count)} projects");
if (_cts.IsCancellationRequested) if (_cts.IsCancellationRequested)

View File

@ -27,7 +27,7 @@ namespace RepoTasks.ProjectModel
_buildEngine = buildEngine; _buildEngine = buildEngine;
} }
public IReadOnlyList<SolutionInfo> Create(IEnumerable<ITaskItem> solutionItems, IDictionary<string, string> properties, CancellationToken ct) public IReadOnlyList<SolutionInfo> Create(IEnumerable<ITaskItem> solutionItems, IDictionary<string, string> properties, string defaultConfig, CancellationToken ct)
{ {
var timer = Stopwatch.StartNew(); var timer = Stopwatch.StartNew();
@ -47,9 +47,9 @@ namespace RepoTasks.ProjectModel
solutionProps[prop.Key] = prop.Value; 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}"; var key = $"SlnInfo:{solutionFile}:{configName}";