Improve csproj project files generation

This commit is contained in:
Wojtek Figat
2023-04-12 14:00:24 +02:00
parent 338e3bbd42
commit 7c39e5726d
2 changed files with 12 additions and 8 deletions

View File

@@ -251,7 +251,7 @@ namespace Flax.Build
SetupProjectConfigurations(project, projectInfo);
// Get all modules aggregated into all binary modules used in all configurations of this target
foreach (var configurationData in mainProject.Configurations)
foreach (var configurationData in project.Configurations)
{
var configurationBinaryModules = GetBinaryModules(projectInfo, configurationData.Target, configurationData.Modules);
foreach (var configurationBinaryModule in configurationBinaryModules)
@@ -323,6 +323,10 @@ namespace Flax.Build
if (targets[0].IsPreBuilt)
continue;
// Skip if project of that name has been already added
if (projects.Any(x => x.OutputType == TargetOutputType.Library && x.Type == TargetType.DotNetCore && x.BaseName == binaryModuleName))
continue;
using (new ProfileEventScope(binaryModuleName))
{
// TODO: add support for extending this code and support generating bindings projects for other scripting languages

View File

@@ -66,7 +66,7 @@ namespace Flax.Build.Projects.VisualStudio
var allPlatforms = project.Configurations.Select(x => x.ArchitectureName).Distinct().ToArray();
csProjectFileContent.AppendLine(string.Format(" <Configurations>{0}</Configurations>", string.Join(";", allConfigurations)));
csProjectFileContent.AppendLine(string.Format(" <Platforms>{0}</Platforms>", string.Join(";", allPlatforms)));
// Provide default platform and configuration
csProjectFileContent.AppendLine(string.Format(" <Configuration Condition=\" '$(Configuration)' == '' \">{0}</Configuration>", defaultConfiguration.Text));
csProjectFileContent.AppendLine(string.Format(" <Platform Condition=\" '$(Platform)' == '' \">{0}</Platform>", defaultConfiguration.ArchitectureName));
@@ -128,11 +128,10 @@ namespace Flax.Build.Projects.VisualStudio
csProjectFileContent.AppendLine(" <ItemGroup>");
// Unused when using explicitly NetCore7 ?
//foreach (var reference in project.CSharp.SystemReferences)
/*foreach (var reference in project.CSharp.SystemReferences)
{
//csProjectFileContent.AppendLine(string.Format(" <Reference Include=\"{0}\" />", reference));
}
csProjectFileContent.AppendLine(string.Format(" <Reference Include=\"{0}\" />", reference));
}*/
foreach (var reference in project.CSharp.FileReferences)
{
@@ -235,7 +234,6 @@ namespace Flax.Build.Projects.VisualStudio
csProjectFileContent.AppendLine(" <UseVSHostingProcess>true</UseVSHostingProcess>");
csProjectFileContent.AppendLine(" </PropertyGroup>");
csProjectFileContent.AppendLine("");
// Generate configuration-specific references
foreach (var reference in configuration.TargetBuildOptions.ScriptingAPI.FileReferences)
@@ -246,9 +244,11 @@ namespace Flax.Build.Projects.VisualStudio
csProjectFileContent.AppendLine(string.Format(" <Reference Include=\"{0}\">", Path.GetFileNameWithoutExtension(reference)));
csProjectFileContent.AppendLine(string.Format(" <HintPath>{0}</HintPath>", Utilities.MakePathRelativeTo(reference, projectDirectory).Replace('/', '\\')));
csProjectFileContent.AppendLine(" </Reference>");
csProjectFileContent.AppendLine(" </ItemGroup >");
csProjectFileContent.AppendLine(" </ItemGroup>");
}
}
csProjectFileContent.AppendLine("");
}
}
}