@@ -31,6 +31,8 @@ public CSharpAutobuildOptions(IBuildActions actions) : base(actions)
3131
3232 public class CSharpAutobuilder : Autobuilder < CSharpAutobuildOptions >
3333 {
34+ private DotNetRule ? dotNetRule ;
35+
3436 private BuildCommandAutoRule ? buildCommandAutoRule ;
3537
3638 public CSharpAutobuilder ( IBuildActions actions , CSharpAutobuildOptions options ) : base ( actions , options ) { }
@@ -103,11 +105,12 @@ BuildScript IntermediateAttempt(BuildScript s) =>
103105 ( s & CheckExtractorRun ( false ) ) |
104106 ( attemptExtractorCleanup & BuildScript . Failure ) ;
105107
108+ this . dotNetRule = new DotNetRule ( ) ;
106109 this . buildCommandAutoRule = new BuildCommandAutoRule ( DotNetRule . WithDotNet ) ;
107110
108111 attempt =
109112 // First try .NET Core
110- IntermediateAttempt ( new DotNetRule ( ) . Analyse ( this , true ) ) |
113+ IntermediateAttempt ( dotNetRule . Analyse ( this , true ) ) |
111114 // Then MSBuild
112115 ( ( ) => IntermediateAttempt ( new MsBuildRule ( ) . Analyse ( this , true ) ) ) |
113116 // And finally look for a script that might be a build script
@@ -164,6 +167,13 @@ protected override void AutobuildFailureDiagnostic()
164167
165168 Diagnostic ( message ) ;
166169 }
170+ else if ( dotNetRule is not null && dotNetRule . NotDotNetProjects . Any ( ) )
171+ {
172+ var message = MakeDiagnostic ( "dotnet-incompatible-projects" , "Some projects are incompatible with .NET Core" ) ;
173+ message . MarkdownMessage =
174+ "CodeQL found some projects which cannot be built with .NET Core:\n " +
175+ string . Join ( '\n ' , dotNetRule . NotDotNetProjects . Select ( p => $ "- `{ p . FullPath } `") ) ;
176+ message . Severity = DiagnosticMessage . TspSeverity . Warning ;
167177
168178 Diagnostic ( message ) ;
169179 }
0 commit comments