diff --git a/Source/Tools/Flax.Build/Build/NativeCpp/Builder.NativeCpp.cs b/Source/Tools/Flax.Build/Build/NativeCpp/Builder.NativeCpp.cs
index 23d2be157..3efe33b38 100644
--- a/Source/Tools/Flax.Build/Build/NativeCpp/Builder.NativeCpp.cs
+++ b/Source/Tools/Flax.Build/Build/NativeCpp/Builder.NativeCpp.cs
@@ -628,10 +628,7 @@ namespace Flax.Build
}
}
if (failed)
- {
- Globals.BuildErrors = true;
- throw new Exception($"Failed to build target {target.Name}. See log.");
- }
+ throw new BuildException($"Failed to build target {target.Name}. See log.");
}
else
{
@@ -692,10 +689,7 @@ namespace Flax.Build
}
}
if (failed)
- {
- Globals.BuildErrors = true;
- throw new Exception($"Failed to build target {target.Name}. See log.");
- }
+ throw new BuildException($"Failed to build target {target.Name}. See log.");
}
else
{
diff --git a/Source/Tools/Flax.Build/Globals.cs b/Source/Tools/Flax.Build/Globals.cs
index 994094124..b5f3088d6 100644
--- a/Source/Tools/Flax.Build/Globals.cs
+++ b/Source/Tools/Flax.Build/Globals.cs
@@ -22,11 +22,6 @@ namespace Flax.Build
///
public static ProjectInfo Project;
- ///
- /// Set when any build related errors were raised.
- ///
- public static bool BuildErrors = false;
-
///
/// All platforms array.
///
diff --git a/Source/Tools/Flax.Build/Program.cs b/Source/Tools/Flax.Build/Program.cs
index bac1caaa8..d6a70de30 100644
--- a/Source/Tools/Flax.Build/Program.cs
+++ b/Source/Tools/Flax.Build/Program.cs
@@ -172,7 +172,7 @@ namespace Flax.Build
catch (Exception ex)
{
// Ignore exception logging for build errors
- if (!Globals.BuildErrors)
+ if (!(ex is BuildException))
Log.Exception(ex);
failed = true;
}
diff --git a/Source/Tools/Flax.Build/Projects/VisualStudio/VisualStudioProjectGenerator.cs b/Source/Tools/Flax.Build/Projects/VisualStudio/VisualStudioProjectGenerator.cs
index 48ecb6425..eda2f7a95 100644
--- a/Source/Tools/Flax.Build/Projects/VisualStudio/VisualStudioProjectGenerator.cs
+++ b/Source/Tools/Flax.Build/Projects/VisualStudio/VisualStudioProjectGenerator.cs
@@ -525,7 +525,7 @@ namespace Flax.Build.Projects.VisualStudio
// Build C# projects (needed for Rider solution wide analysis)
build |= project.Type == TargetType.DotNetCore;
- //
+ // Always build the project named after solution if main project was not set
build |= solution.MainProject == null && project.Name == solution.Name;
}
else if (firstPlatformMatch != -1 && !configuration.Name.StartsWith("Editor."))
diff --git a/Source/Tools/Flax.Build/Utilities/BuildException.cs b/Source/Tools/Flax.Build/Utilities/BuildException.cs
new file mode 100644
index 000000000..5118c4154
--- /dev/null
+++ b/Source/Tools/Flax.Build/Utilities/BuildException.cs
@@ -0,0 +1,14 @@
+// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
+
+using System;
+
+namespace Flax.Build
+{
+ internal class BuildException : Exception
+ {
+ public BuildException(string message)
+ : base(message)
+ {
+ }
+ }
+}