diff --git a/Source/Tools/Flax.Build/Build/DotNet/Builder.DotNet.cs b/Source/Tools/Flax.Build/Build/DotNet/Builder.DotNet.cs index fb1f84323..f4ae09a1a 100644 --- a/Source/Tools/Flax.Build/Build/DotNet/Builder.DotNet.cs +++ b/Source/Tools/Flax.Build/Build/DotNet/Builder.DotNet.cs @@ -256,6 +256,13 @@ namespace Flax.Build #endif if (buildOptions.ScriptingAPI.IgnoreMissingDocumentationWarnings) args.Add("-nowarn:1591"); + if (buildOptions.ScriptingAPI.IgnoreSpecificWarnings.Any()) + { + foreach (var warningString in buildOptions.ScriptingAPI.IgnoreSpecificWarnings) + { + args.Add($"-nowarn:{warningString}"); + } + } // Optimizations prevent debugging, only enable in release builds by default var optimize = optimizeAssembly.HasValue ? optimizeAssembly.Value : buildData.Configuration == TargetConfiguration.Release; diff --git a/Source/Tools/Flax.Build/Build/NativeCpp/BuildOptions.cs b/Source/Tools/Flax.Build/Build/NativeCpp/BuildOptions.cs index fb94131a1..6f693a03b 100644 --- a/Source/Tools/Flax.Build/Build/NativeCpp/BuildOptions.cs +++ b/Source/Tools/Flax.Build/Build/NativeCpp/BuildOptions.cs @@ -235,6 +235,11 @@ namespace Flax.Build.NativeCpp /// public HashSet Analyzers; + /// + /// The specific .NET warning to ignore. + /// + public HashSet IgnoreSpecificWarnings; + /// /// True if ignore compilation warnings due to missing code documentation comments. /// @@ -265,6 +270,7 @@ namespace Flax.Build.NativeCpp FileReferences.AddRange(other.FileReferences); Analyzers.AddRange(other.Analyzers); IgnoreMissingDocumentationWarnings |= other.IgnoreMissingDocumentationWarnings; + IgnoreSpecificWarnings.AddRange(other.IgnoreSpecificWarnings); } } @@ -338,6 +344,7 @@ namespace Flax.Build.NativeCpp }, FileReferences = new HashSet(), Analyzers = new HashSet(), + IgnoreSpecificWarnings = new HashSet(), }; /// diff --git a/Source/Tools/Flax.Build/Projects/VisualStudio/CSProjectGenerator.cs b/Source/Tools/Flax.Build/Projects/VisualStudio/CSProjectGenerator.cs index a83a5a7f6..c5359f66e 100644 --- a/Source/Tools/Flax.Build/Projects/VisualStudio/CSProjectGenerator.cs +++ b/Source/Tools/Flax.Build/Projects/VisualStudio/CSProjectGenerator.cs @@ -125,6 +125,13 @@ namespace Flax.Build.Projects.VisualStudio csProjectFileContent.AppendLine(" true"); if (configuration.TargetBuildOptions.ScriptingAPI.IgnoreMissingDocumentationWarnings) csProjectFileContent.AppendLine(" 1591"); + if (configuration.TargetBuildOptions.ScriptingAPI.IgnoreSpecificWarnings.Any()) + { + foreach (var warningString in configuration.TargetBuildOptions.ScriptingAPI.IgnoreSpecificWarnings) + { + csProjectFileContent.AppendLine($" {warningString}"); + } + } csProjectFileContent.AppendLine(string.Format(" {0}\\{1}.CSharp.xml", outputPath, project.BaseName)); csProjectFileContent.AppendLine(" true"); csProjectFileContent.AppendLine(" "); @@ -156,6 +163,13 @@ namespace Flax.Build.Projects.VisualStudio csProjectFileContent.AppendLine(" true"); if (configuration.TargetBuildOptions.ScriptingAPI.IgnoreMissingDocumentationWarnings) csProjectFileContent.AppendLine(" 1591"); + if (configuration.TargetBuildOptions.ScriptingAPI.IgnoreSpecificWarnings.Any()) + { + foreach (var warningString in configuration.TargetBuildOptions.ScriptingAPI.IgnoreSpecificWarnings) + { + csProjectFileContent.AppendLine($" {warningString}"); + } + } csProjectFileContent.AppendLine(string.Format(" {0}\\{1}.CSharp.xml", outputPath, project.BaseName)); csProjectFileContent.AppendLine(" true"); csProjectFileContent.AppendLine(" "); diff --git a/Source/Tools/Flax.Build/Projects/VisualStudio/CSSDKProjectGenerator.cs b/Source/Tools/Flax.Build/Projects/VisualStudio/CSSDKProjectGenerator.cs index 64c333499..9059cda94 100644 --- a/Source/Tools/Flax.Build/Projects/VisualStudio/CSSDKProjectGenerator.cs +++ b/Source/Tools/Flax.Build/Projects/VisualStudio/CSSDKProjectGenerator.cs @@ -284,6 +284,13 @@ namespace Flax.Build.Projects.VisualStudio csProjectFileContent.AppendLine(" true"); if (configuration.TargetBuildOptions.ScriptingAPI.IgnoreMissingDocumentationWarnings) csProjectFileContent.AppendLine(" 1591"); + if (configuration.TargetBuildOptions.ScriptingAPI.IgnoreSpecificWarnings.Any()) + { + foreach (var warningString in configuration.TargetBuildOptions.ScriptingAPI.IgnoreSpecificWarnings) + { + csProjectFileContent.AppendLine($" {warningString}"); + } + } csProjectFileContent.AppendLine(string.Format(" {0}\\{1}.CSharp.xml", outputPath, project.BaseName)); csProjectFileContent.AppendLine(" true");