diff --git a/Source/Tools/Flax.Build/Build/Builder.Projects.cs b/Source/Tools/Flax.Build/Build/Builder.Projects.cs index 21aa25788..bb645a940 100644 --- a/Source/Tools/Flax.Build/Build/Builder.Projects.cs +++ b/Source/Tools/Flax.Build/Build/Builder.Projects.cs @@ -229,7 +229,7 @@ namespace Flax.Build var project = mainProject = generator.CreateProject(); if (targets[0].CustomExternalProjectFilePath == null) project.Type = TargetType.NativeCpp; - project.Name = projectName; + project.Name = project.BaseName = projectName; project.Targets = targets; project.SearchPaths = new string[0]; project.WorkspaceRootPath = projectInfo.ProjectFolderPath; @@ -368,7 +368,9 @@ namespace Flax.Build // Create project description var project = dotNetProjectGenerator.CreateProject(); project.Type = TargetType.DotNet; - project.Name = binaryModuleName; + project.Name = project.BaseName = binaryModuleName; + if (mainSolutionProject != null && projectInfo == rootProject) + project.Name += ".CSharp"; // Prevent overlapping name with native code project project.OutputType = TargetOutputType.Library; project.Targets = targets; project.SearchPaths = new string[0]; @@ -424,7 +426,7 @@ namespace Flax.Build !string.IsNullOrEmpty(dependencyModule.BinaryModuleName) && dependencyModule.BinaryModuleName != binaryModule.Key) { - var dependencyProject = projects.Find(x => x != null && x.Generator.Type == project.Generator.Type && x.Name == dependencyModule.BinaryModuleName); + var dependencyProject = projects.Find(x => x != null && x.Generator.Type == project.Generator.Type && x.BaseName == dependencyModule.BinaryModuleName); if (dependencyProject != null) { // Reference that project @@ -479,7 +481,7 @@ namespace Flax.Build { project = dotNetProjectGenerator.CreateProject(); project.Type = TargetType.DotNet; - project.Name = rulesProjectName; + project.Name = project.BaseName = rulesProjectName; project.Targets = new[] { target }; project.SearchPaths = new string[0]; project.WorkspaceRootPath = workspaceRoot; diff --git a/Source/Tools/Flax.Build/Projects/Project.cs b/Source/Tools/Flax.Build/Projects/Project.cs index c583c96c8..93552b193 100644 --- a/Source/Tools/Flax.Build/Projects/Project.cs +++ b/Source/Tools/Flax.Build/Projects/Project.cs @@ -17,6 +17,11 @@ namespace Flax.Build.Projects /// public ProjectGenerator Generator; + /// + /// The project base name (might not be unique within solution - eg. Name = BaseName + '.CSharp' to prevent overlaps). + /// + public string BaseName; + /// /// The project name. /// diff --git a/Source/Tools/Flax.Build/Projects/VisualStudio/CSProjectGenerator.cs b/Source/Tools/Flax.Build/Projects/VisualStudio/CSProjectGenerator.cs index 01807c098..5ce11ffcd 100644 --- a/Source/Tools/Flax.Build/Projects/VisualStudio/CSProjectGenerator.cs +++ b/Source/Tools/Flax.Build/Projects/VisualStudio/CSProjectGenerator.cs @@ -75,8 +75,8 @@ namespace Flax.Build.Projects.VisualStudio default: throw new ArgumentOutOfRangeException(); } - csProjectFileContent.AppendLine(string.Format(" {0}", project.Name)); - csProjectFileContent.AppendLine(string.Format(" {0}.CSharp", project.Name)); + csProjectFileContent.AppendLine(string.Format(" {0}", project.BaseName)); + csProjectFileContent.AppendLine(string.Format(" {0}.CSharp", project.BaseName)); csProjectFileContent.AppendLine(string.Format(" {0}", "v4.5.2")); csProjectFileContent.AppendLine(" 7.3"); csProjectFileContent.AppendLine(" 512"); @@ -118,7 +118,7 @@ namespace Flax.Build.Projects.VisualStudio csProjectFileContent.AppendLine(" true"); if (configuration.TargetBuildOptions.ScriptingAPI.IgnoreMissingDocumentationWarnings) csProjectFileContent.AppendLine(" 1591"); - csProjectFileContent.AppendLine(string.Format(" {0}\\{1}.CSharp.xml", outputPath, project.Name)); + csProjectFileContent.AppendLine(string.Format(" {0}\\{1}.CSharp.xml", outputPath, project.BaseName)); csProjectFileContent.AppendLine(" true"); csProjectFileContent.AppendLine(" "); } @@ -149,7 +149,7 @@ namespace Flax.Build.Projects.VisualStudio csProjectFileContent.AppendLine(" true"); if (configuration.TargetBuildOptions.ScriptingAPI.IgnoreMissingDocumentationWarnings) csProjectFileContent.AppendLine(" 1591"); - csProjectFileContent.AppendLine(string.Format(" {0}\\{1}.CSharp.xml", outputPath, project.Name)); + csProjectFileContent.AppendLine(string.Format(" {0}\\{1}.CSharp.xml", outputPath, project.BaseName)); csProjectFileContent.AppendLine(" true"); csProjectFileContent.AppendLine(" "); } @@ -174,7 +174,7 @@ namespace Flax.Build.Projects.VisualStudio { csProjectFileContent.AppendLine(string.Format(" ", Utilities.MakePathRelativeTo(dependency.Path, projectDirectory))); csProjectFileContent.AppendLine(string.Format(" {0}", ((VisualStudioProject)dependency).ProjectGuid.ToString("B").ToUpperInvariant())); - csProjectFileContent.AppendLine(string.Format(" {0}", dependency.Name)); + csProjectFileContent.AppendLine(string.Format(" {0}", dependency.BaseName)); csProjectFileContent.AppendLine(" "); } diff --git a/Source/Tools/Flax.Build/Projects/VisualStudio/VCProjectGenerator.cs b/Source/Tools/Flax.Build/Projects/VisualStudio/VCProjectGenerator.cs index 54d8eb6df..42f6095c3 100644 --- a/Source/Tools/Flax.Build/Projects/VisualStudio/VCProjectGenerator.cs +++ b/Source/Tools/Flax.Build/Projects/VisualStudio/VCProjectGenerator.cs @@ -97,7 +97,7 @@ namespace Flax.Build.Projects.VisualStudio // Globals vcProjectFileContent.AppendLine(" "); vcProjectFileContent.AppendLine(string.Format(" {0}", vsProject.ProjectGuid.ToString("B").ToUpperInvariant())); - vcProjectFileContent.AppendLine(string.Format(" {0}", project.Name)); + vcProjectFileContent.AppendLine(string.Format(" {0}", project.BaseName)); vcProjectFileContent.AppendLine(string.Format(" {0}", projectFilePlatformToolsetVersion)); vcProjectFileContent.AppendLine(string.Format(" {0}", projectFileToolVersion)); vcProjectFileContent.AppendLine(" Native"); diff --git a/Source/Tools/Flax.Build/Projects/VisualStudio/VisualStudioProjectGenerator.cs b/Source/Tools/Flax.Build/Projects/VisualStudio/VisualStudioProjectGenerator.cs index 35b039db2..3aef1bbb8 100644 --- a/Source/Tools/Flax.Build/Projects/VisualStudio/VisualStudioProjectGenerator.cs +++ b/Source/Tools/Flax.Build/Projects/VisualStudio/VisualStudioProjectGenerator.cs @@ -40,7 +40,7 @@ namespace Flax.Build.Projects.VisualStudio vcProjectFileContent.AppendLine(" "); vcProjectFileContent.AppendLine(" "); vcProjectFileContent.AppendLine(string.Format(" {0}", ProjectGuid.ToString("B").ToUpperInvariant())); - vcProjectFileContent.AppendLine(string.Format(" {0}", Name)); + vcProjectFileContent.AppendLine(string.Format(" {0}", BaseName)); vcProjectFileContent.AppendLine(string.Format(" {0}", projectFileToolVersion)); vcProjectFileContent.AppendLine(string.Format(" {0}", Configuration.AndroidPlatformApi)); vcProjectFileContent.AppendLine(string.Format(" {0}", "arm64-v8a")); @@ -556,7 +556,7 @@ namespace Flax.Build.Projects.VisualStudio targetsSorted.Sort((a, b) => b.Platforms.Length.CompareTo(a.Platforms.Length)); var target = targetsSorted.First(x => x.Platforms.Contains(TargetPlatform.Android)); project.Type = TargetType.NativeCpp; - project.Name = "Android"; + project.Name = project.BaseName = "Android"; project.Targets = new Target[0]; project.SearchPaths = new string[0]; project.WorkspaceRootPath = rootProject.ProjectFolderPath; diff --git a/Source/Tools/Flax.Build/Projects/VisualStudioCode/VisualStudioCodeProjectGenerator.cs b/Source/Tools/Flax.Build/Projects/VisualStudioCode/VisualStudioCodeProjectGenerator.cs index f726ea0c4..e925e70ae 100644 --- a/Source/Tools/Flax.Build/Projects/VisualStudioCode/VisualStudioCodeProjectGenerator.cs +++ b/Source/Tools/Flax.Build/Projects/VisualStudioCode/VisualStudioCodeProjectGenerator.cs @@ -340,7 +340,7 @@ namespace Flax.Build.Projects.VisualStudioCode } break; case TargetPlatform.Linux: - if (configuration.Platform == TargetPlatform.Linux && (outputType != TargetOutputType.Executable || project.Name == "Flax") && configuration.Name.StartsWith("Editor.")) + if (configuration.Platform == TargetPlatform.Linux && (outputType != TargetOutputType.Executable || project.BaseName == "Flax") && configuration.Name.StartsWith("Editor.")) { json.AddField("program", Path.Combine(Globals.EngineRoot, "Binaries", "Editor", "Linux", configuration.ConfigurationName, "FlaxEditor")); } @@ -388,7 +388,7 @@ namespace Flax.Build.Projects.VisualStudioCode } break; case TargetPlatform.Mac: - if (configuration.Platform == TargetPlatform.Mac && (outputType != TargetOutputType.Executable || project.Name == "Flax") && configuration.Name.StartsWith("Editor.")) + if (configuration.Platform == TargetPlatform.Mac && (outputType != TargetOutputType.Executable || project.BaseName == "Flax") && configuration.Name.StartsWith("Editor.")) { json.AddField("program", Path.Combine(Globals.EngineRoot, "Binaries", "Editor", "Mac", configuration.ConfigurationName, "FlaxEditor")); }