From f8e3a74f9ee5e761a8f8869c897d4cff7068ca87 Mon Sep 17 00:00:00 2001 From: Ignacio Etcheverry Date: Fri, 4 Sep 2020 01:49:32 +0200 Subject: [PATCH] Fix InvalidOperationException when migrating from 3.2.1 or older csproj --- .../GodotTools.ProjectEditor/ProjectUtils.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectUtils.cs b/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectUtils.cs index 5b04c8b8131..9a3280bc19e 100644 --- a/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectUtils.cs +++ b/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectUtils.cs @@ -287,10 +287,19 @@ namespace GodotTools.ProjectEditor "ConsolePause" }; - foreach (var config in new[] {"ExportDebug", "ExportRelease", "Debug"}) + var configNames = new[] + { + "ExportDebug", "ExportRelease", "Debug", + "Tools", "Release" // Include old config names as well in case it's upgrading from 3.2.1 or older + }; + + foreach (var config in configNames) { var group = root.PropertyGroups - .First(g => g.Condition.Trim() == $"'$(Configuration)|$(Platform)' == '{config}|AnyCPU'"); + .FirstOrDefault(g => g.Condition.Trim() == $"'$(Configuration)|$(Platform)' == '{config}|AnyCPU'"); + + if (group == null) + continue; RemoveElements(group.Properties.Where(p => yabaiPropertiesForConfigs.Contains(p.Name)));