From 316f253558c447a5789334a28fa1817dc71d5aa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=B4ng=20V=C4=83n=20T=C3=ACnh?= Date: Sun, 7 Apr 2024 00:25:34 +0700 Subject: [PATCH] Show errors when solution file is missing in C# project Fixes: #86591 Co-authored-by: Raul Santos --- .../editor/GodotTools/GodotTools/Export/ExportPlugin.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs b/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs index 46020fda8959..57611d5f4c6d 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs @@ -90,6 +90,13 @@ namespace GodotTools.Export $"Resource of type {Internal.CSharpLanguageType} has an invalid file extension: {path}", nameof(path)); + if (!ProjectContainsDotNet()) + { + _maybeLastExportError = $"This project contains C# files but no solution file was found at the following path: {GodotSharpDirs.ProjectSlnPath}\n" + + "A solution file is required for projects with C# files. Please ensure that the solution file exists in the specified location and try again."; + throw new InvalidOperationException($"{path} is a C# file but no solution file exists."); + } + // TODO: What if the source file is not part of the game's C# project? bool includeScriptsContent = (bool)GetOption("dotnet/include_scripts_content");