Support user defined .NET analyzers/source generators in Flax.Build

This commit is contained in:
2023-07-30 21:43:28 +03:00
parent 80bcc0f32e
commit 13e11091fc
3 changed files with 22 additions and 5 deletions

View File

@@ -247,6 +247,14 @@ namespace Flax.Build.Projects.VisualStudio
csProjectFileContent.AppendLine(" </ItemGroup>");
}
}
foreach (var analyzer in configuration.TargetBuildOptions.ScriptingAPI.Analyzers)
{
csProjectFileContent.AppendLine(string.Format(" <ItemGroup Condition=\" '$(Configuration)|$(Platform)' == '{0}' \">", configuration.Name));
csProjectFileContent.AppendLine(string.Format(" <Analyzer Include=\"{0}\">", Path.GetFileNameWithoutExtension(analyzer)));
csProjectFileContent.AppendLine(string.Format(" <HintPath>{0}</HintPath>", Utilities.MakePathRelativeTo(analyzer, projectDirectory).Replace('/', '\\')));
csProjectFileContent.AppendLine(" </Analyzer>");
csProjectFileContent.AppendLine(" </ItemGroup>");
}
csProjectFileContent.AppendLine("");
}