diff --git a/Source/Tools/Flax.Build/Build/DotNet/Builder.DotNet.cs b/Source/Tools/Flax.Build/Build/DotNet/Builder.DotNet.cs index 13433f92c..2cdc57686 100644 --- a/Source/Tools/Flax.Build/Build/DotNet/Builder.DotNet.cs +++ b/Source/Tools/Flax.Build/Build/DotNet/Builder.DotNet.cs @@ -272,8 +272,10 @@ namespace Flax.Build foreach (var reference in fileReferences) args.Add(string.Format("/reference:\"{0}\"", reference)); #if USE_NETCORE - foreach (var analyzer in buildOptions.ScriptingAPI.SystemAnalyzers) - args.Add(string.Format("/analyzer:\"{0}{1}.dll\"", referenceAnalyzers, analyzer)); + foreach (var systemAnalyzer in buildOptions.ScriptingAPI.SystemAnalyzers) + args.Add(string.Format("/analyzer:\"{0}{1}.dll\"", referenceAnalyzers, systemAnalyzer)); + foreach (var analyzer in buildOptions.ScriptingAPI.Analyzers) + args.Add(string.Format("/analyzer:\"{0}\"", analyzer)); #endif foreach (var sourceFile in sourceFiles) args.Add("\"" + sourceFile + "\""); diff --git a/Source/Tools/Flax.Build/Build/NativeCpp/BuildOptions.cs b/Source/Tools/Flax.Build/Build/NativeCpp/BuildOptions.cs index ef365d3b7..e612c0a95 100644 --- a/Source/Tools/Flax.Build/Build/NativeCpp/BuildOptions.cs +++ b/Source/Tools/Flax.Build/Build/NativeCpp/BuildOptions.cs @@ -200,14 +200,19 @@ namespace Flax.Build.NativeCpp public HashSet SystemReferences; /// - /// The .Net libraries references (dll or exe files paths). + /// The system analyzers/source generators. + /// + public HashSet SystemAnalyzers; + + /// + /// The .NET libraries references (dll or exe files paths). /// public HashSet FileReferences; /// - /// The .Net libraries references (dll or exe files paths). + /// The .NET analyzers (dll or exe files paths). /// - public HashSet SystemAnalyzers; + public HashSet Analyzers; /// /// True if ignore compilation warnings due to missing code documentation comments. @@ -232,6 +237,7 @@ namespace Flax.Build.NativeCpp Defines.AddRange(other.Defines); SystemReferences.AddRange(other.SystemReferences); FileReferences.AddRange(other.FileReferences); + Analyzers.AddRange(other.Analyzers); IgnoreMissingDocumentationWarnings |= other.IgnoreMissingDocumentationWarnings; } } @@ -305,6 +311,7 @@ namespace Flax.Build.NativeCpp "Microsoft.Interop.SourceGeneration", }, FileReferences = new HashSet(), + Analyzers = new HashSet(), }; /// diff --git a/Source/Tools/Flax.Build/Projects/VisualStudio/CSSDKProjectGenerator.cs b/Source/Tools/Flax.Build/Projects/VisualStudio/CSSDKProjectGenerator.cs index efce04776..5fba0dc43 100644 --- a/Source/Tools/Flax.Build/Projects/VisualStudio/CSSDKProjectGenerator.cs +++ b/Source/Tools/Flax.Build/Projects/VisualStudio/CSSDKProjectGenerator.cs @@ -247,6 +247,14 @@ namespace Flax.Build.Projects.VisualStudio csProjectFileContent.AppendLine(" "); } } + foreach (var analyzer in configuration.TargetBuildOptions.ScriptingAPI.Analyzers) + { + csProjectFileContent.AppendLine(string.Format(" ", configuration.Name)); + csProjectFileContent.AppendLine(string.Format(" ", Path.GetFileNameWithoutExtension(analyzer))); + csProjectFileContent.AppendLine(string.Format(" {0}", Utilities.MakePathRelativeTo(analyzer, projectDirectory).Replace('/', '\\'))); + csProjectFileContent.AppendLine(" "); + csProjectFileContent.AppendLine(" "); + } csProjectFileContent.AppendLine(""); }