aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarsten Heimrich <karsten.heimrich@qt.io>2023-03-01 14:33:46 +0100
committerKarsten Heimrich <karsten.heimrich@qt.io>2023-03-15 13:22:20 +0000
commit85b6160296d4b800ccad5b735a205ad5c18388d6 (patch)
tree7349884fab84623775690abd83d2f7ff5f2a7ffd
parentaf5b575965ed3e9e73218a0b93b81a14c631a049 (diff)
Cleanup SelectSolutionPlatform(...) function
Change-Id: Ib1d9508d9a2c6cbfe1eb3034651794be732850db Reviewed-by: Miguel Costa <miguel.costa@qt.io>
-rw-r--r--QtVsTools.Core/QtProject.cs20
1 files changed, 9 insertions, 11 deletions
diff --git a/QtVsTools.Core/QtProject.cs b/QtVsTools.Core/QtProject.cs
index 8ac146d1..6c02c4b4 100644
--- a/QtVsTools.Core/QtProject.cs
+++ b/QtVsTools.Core/QtProject.cs
@@ -886,25 +886,23 @@ namespace QtVsTools.Core
{
ThreadHelper.ThrowIfNotOnUIThread();
- foreach (SolutionConfiguration solutionCfg in dte.Solution.SolutionBuild.SolutionConfigurations) {
+ var solutionBuild = dte.Solution.SolutionBuild;
+ foreach (SolutionConfiguration solutionCfg in solutionBuild.SolutionConfigurations) {
+ if (solutionCfg.Name != solutionBuild.ActiveConfiguration.Name)
+ continue;
+
var contexts = solutionCfg.SolutionContexts;
for (var i = 1; i <= contexts.Count; ++i) {
- SolutionContext ctx = null;
try {
- ctx = contexts.Item(i);
- } catch (ArgumentException) {
- // This may happen if we encounter an unloaded project.
- continue;
- }
-
- if (ctx.PlatformName == platformName
- && solutionCfg.Name == dte.Solution.SolutionBuild.ActiveConfiguration.Name) {
+ if (contexts.Item(i).PlatformName != platformName)
+ continue;
solutionCfg.Activate();
return true;
+ } catch {
+ // This may happen if we encounter an unloaded project.
}
}
}
-
return false;
}