From 8db29a30e0372f9f07281aea153ec2a7a931a2d4 Mon Sep 17 00:00:00 2001 From: Ari Vuollet Date: Sun, 20 Apr 2025 01:11:29 +0300 Subject: [PATCH 1/3] Fix VC++ project file building on macOS Rider --- .../Flax.Build/Projects/VisualStudio/VCProjectGenerator.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/Tools/Flax.Build/Projects/VisualStudio/VCProjectGenerator.cs b/Source/Tools/Flax.Build/Projects/VisualStudio/VCProjectGenerator.cs index 1a52274a7..371cf3933 100644 --- a/Source/Tools/Flax.Build/Projects/VisualStudio/VCProjectGenerator.cs +++ b/Source/Tools/Flax.Build/Projects/VisualStudio/VCProjectGenerator.cs @@ -115,6 +115,7 @@ namespace Flax.Build.Projects.VisualStudio if (Version >= VisualStudioVersion.VisualStudio2022) vcProjectFileContent.AppendLine(" false"); vcProjectFileContent.AppendLine(" ./"); + vcProjectFileContent.AppendLine(" ./"); vcProjectFileContent.AppendLine(" "); // Default properties @@ -377,9 +378,9 @@ namespace Flax.Build.Projects.VisualStudio vcUserFileContent.AppendLine(""); - if (platforms.Any(x => x.Target == TargetPlatform.Linux)) + if (platforms.Any(x => x.Target == TargetPlatform.Linux || x.Target == TargetPlatform.Mac)) { - // Override MSBuild .targets file with one that runs NMake commands (workaround for Rider on Linux) + // Override MSBuild .targets file with one that runs NMake commands (workaround for Rider not finding "Microsoft.Cpp.Default.props" file) var cppTargetsFileContent = new StringBuilder(); cppTargetsFileContent.AppendLine(""); cppTargetsFileContent.AppendLine(" "); From 518f9dc9dc5598eb10a31c77e76cd6174c7b5b84 Mon Sep 17 00:00:00 2001 From: Ari Vuollet Date: Wed, 17 Dec 2025 02:14:22 +0200 Subject: [PATCH 2/3] Launch editor when debugging VC++ projects in Rider Linux/macOS --- .../Projects/VisualStudio/VCProjectGenerator.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Source/Tools/Flax.Build/Projects/VisualStudio/VCProjectGenerator.cs b/Source/Tools/Flax.Build/Projects/VisualStudio/VCProjectGenerator.cs index 371cf3933..290d194cf 100644 --- a/Source/Tools/Flax.Build/Projects/VisualStudio/VCProjectGenerator.cs +++ b/Source/Tools/Flax.Build/Projects/VisualStudio/VCProjectGenerator.cs @@ -380,6 +380,10 @@ namespace Flax.Build.Projects.VisualStudio if (platforms.Any(x => x.Target == TargetPlatform.Linux || x.Target == TargetPlatform.Mac)) { + var editorPath = Utilities.NormalizePath(Path.Combine(Globals.EngineRoot, Platform.GetEditorBinaryDirectory(), "$(Configuration.Split('.')[2])", $"FlaxEditor{Utilities.GetPlatformExecutableExt()}")).Replace('\\', '/'); + var debuggerProjectPath = Globals.Project.Name == "Flax" ? "" : Globals.Project.ProjectFolderPath; + var debuggerWorkingDirectory = Globals.Project.ProjectFolderPath; + // Override MSBuild .targets file with one that runs NMake commands (workaround for Rider not finding "Microsoft.Cpp.Default.props" file) var cppTargetsFileContent = new StringBuilder(); cppTargetsFileContent.AppendLine(""); @@ -396,6 +400,12 @@ namespace Flax.Build.Projects.VisualStudio cppTargetsFileContent.AppendLine(" "); cppTargetsFileContent.AppendLine(" $(RootNamespace)$(Configuration.Split('.')[0])"); cppTargetsFileContent.AppendLine(" $(OutDir)/$(TargetName)$(TargetExt)"); + if (!string.IsNullOrEmpty(debuggerProjectPath)) + cppTargetsFileContent.AppendLine(string.Format(" -project \"{0}\"", debuggerProjectPath)); + else + cppTargetsFileContent.AppendLine(" "); + cppTargetsFileContent.AppendLine(string.Format(" {0}", editorPath)); + cppTargetsFileContent.AppendLine(string.Format(" {0}", debuggerWorkingDirectory)); cppTargetsFileContent.AppendLine(" "); cppTargetsFileContent.AppendLine(""); From f14ba6ace6e88f2b56e982e5ada126a7641f9c55 Mon Sep 17 00:00:00 2001 From: Ari Vuollet Date: Wed, 17 Dec 2025 02:15:09 +0200 Subject: [PATCH 3/3] Fix Flax C#-project launchSettings.json to launch without project --- .../Projects/VisualStudio/VisualStudioProjectGenerator.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Tools/Flax.Build/Projects/VisualStudio/VisualStudioProjectGenerator.cs b/Source/Tools/Flax.Build/Projects/VisualStudio/VisualStudioProjectGenerator.cs index d657f6247..6a573e0fd 100644 --- a/Source/Tools/Flax.Build/Projects/VisualStudio/VisualStudioProjectGenerator.cs +++ b/Source/Tools/Flax.Build/Projects/VisualStudio/VisualStudioProjectGenerator.cs @@ -633,6 +633,7 @@ namespace Flax.Build.Projects.VisualStudio var configuration = "Development"; var editorPath = Utilities.NormalizePath(Path.Combine(Globals.EngineRoot, Platform.GetEditorBinaryDirectory(), configuration, $"FlaxEditor{Utilities.GetPlatformExecutableExt()}")).Replace('\\', '/'); var workspacePath = Utilities.NormalizePath(solutionDirectory).Replace('\\', '/'); + var args = Globals.Project.Name == "Flax" ? "" : $"-project \\\"{workspacePath}\\\""; foreach (var project in projects) { if (project.Type == TargetType.DotNetCore) @@ -645,7 +646,7 @@ namespace Flax.Build.Projects.VisualStudio profile.AppendLine(" \"commandName\": \"Executable\","); profile.AppendLine($" \"workingDirectory\": \"{workspacePath}\","); profile.AppendLine($" \"executablePath\": \"{editorPath}\","); - profile.AppendLine($" \"commandLineArgs\": \"-project \\\"{workspacePath}\\\"\","); + profile.AppendLine($" \"commandLineArgs\": \"{args}\","); profile.AppendLine(" \"nativeDebugging\": false"); profile.Append(" }"); if (profiles.ContainsKey(path))