From a94cc64806fffc5893411d89e9ca0d018f319381 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sun, 20 Oct 2024 23:29:36 +0200 Subject: [PATCH] Speculative fix for missing main project info in VS Code project generation --- .../VisualStudioCode/VisualStudioCodeProjectGenerator.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Tools/Flax.Build/Projects/VisualStudioCode/VisualStudioCodeProjectGenerator.cs b/Source/Tools/Flax.Build/Projects/VisualStudioCode/VisualStudioCodeProjectGenerator.cs index 1830b8efe..88b7a8df5 100644 --- a/Source/Tools/Flax.Build/Projects/VisualStudioCode/VisualStudioCodeProjectGenerator.cs +++ b/Source/Tools/Flax.Build/Projects/VisualStudioCode/VisualStudioCodeProjectGenerator.cs @@ -301,7 +301,8 @@ namespace Flax.Build.Projects.VisualStudioCode json.BeginArray("configurations"); { var cppProject = solution.Projects.FirstOrDefault(x => x.BaseName == solution.Name || x.Name == solution.Name); - var csharpProject = solution.Projects.FirstOrDefault(x => x.BaseName == solution.MainProject.Targets[0].Modules[0] || x.Name == solution.MainProject.Targets[0].Modules[0]); + var mainProjectModule = solution.MainProject?.Targets.Length != 0 ? solution.MainProject.Targets[0].Modules[0] : null; + var csharpProject = mainProjectModule != null ? solution.Projects.FirstOrDefault(x => x.BaseName == mainProjectModule || x.Name == mainProjectModule) : null; if (cppProject != null) {