diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json index 0e749245..34b5276d 100644 --- a/.nuke/build.schema.json +++ b/.nuke/build.schema.json @@ -86,10 +86,6 @@ ] } }, - "Solution": { - "type": "string", - "description": "Path to a solution file that is automatically loaded" - }, "Target": { "type": "array", "description": "List of targets to be invoked. Default is '{default_target}'", diff --git a/source/Nevermore/CommandParameterValues.cs b/source/Nevermore/CommandParameterValues.cs index e6600017..860e56cc 100644 --- a/source/Nevermore/CommandParameterValues.cs +++ b/source/Nevermore/CommandParameterValues.cs @@ -227,10 +227,34 @@ public void AddRange(CommandParameterValues other) { foreach (var item in other) { - if (ContainsKey(item.Key)) - throw new Exception($"The parameter {item.Key} already exists"); + CheckForDuplicate(item); this[item.Key] = item.Value; } } + + void CheckForDuplicate(KeyValuePair item) + { + if (!ContainsKey(item.Key)) + { + return; + } + var existingValue = this[item.Key]; + var newValue = item.Value; + if (existingValue.Equals(newValue)) + { + return; + } + if (existingValue is IEnumerable existingValueEnumerable && newValue is IEnumerable newValueEnumerable) + { + var existingValueSet = existingValueEnumerable.Cast().ToHashSet(); + var newValueSet = newValueEnumerable.Cast().ToHashSet(); + if (existingValueSet.SetEquals(newValueSet)) + { + return; + } + } + + throw new Exception($"The parameter {item.Key} already exists and has a different value"); + } } } \ No newline at end of file