Skip to content

Commit 430af66

Browse files
committed
Show .NET core error only if files exist
1 parent b203533 commit 430af66

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

csharp/autobuilder/Semmle.Autobuild.CSharp/CSharpAutobuilder.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,12 @@ protected override void AutobuildFailureDiagnostic()
125125
AddDiagnostic(message);
126126
}
127127

128+
// project files which don't exist get marked as not .NET core projects, but we don't want
129+
// to show an error for this if the files don't exist
130+
var foundNotDotNetProjects = autoBuildRule.DotNetRule.NotDotNetProjects.Where(
131+
proj => this.Actions.FileExists(proj.FullPath)
132+
);
133+
128134
// both dotnet and msbuild builds require project or solution files; if we haven't found any
129135
// then neither of those rules would've worked
130136
if (this.ProjectsOrSolutionsToBuild.Count == 0)
@@ -137,7 +143,8 @@ protected override void AutobuildFailureDiagnostic()
137143

138144
AddDiagnostic(message);
139145
}
140-
else if (autoBuildRule.DotNetRule.NotDotNetProjects.Any())
146+
// show a warning if there are projects which are not compatible with .NET Core, in case that is unintentional
147+
else if (foundNotDotNetProjects.Any())
141148
{
142149
var message = MakeDiagnostic("dotnet-incompatible-projects", "Some projects are incompatible with .NET Core");
143150
message.MarkdownMessage =

0 commit comments

Comments
 (0)