Skip to content

Commit

Permalink
chore: Add warnings for UnresolvedAnalyzerReference (dotnet#9623)
Browse files Browse the repository at this point in the history
  • Loading branch information
filzrev authored and p-kostov committed Jun 28, 2024
1 parent 5f1ca96 commit f3dc21f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Docfx.Dotnet/DotnetApiCatalog.Compile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Microsoft.Build.Framework;
using Microsoft.Build.Logging;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.MSBuild;

#nullable enable
Expand Down Expand Up @@ -132,6 +133,13 @@ await LoadCompilationFromProject(project.AbsolutePath) is { } compilation)
await Process.Start("dotnet", $"restore \"{path}\"").WaitForExitAsync();
}
project = await workspace.OpenProjectAsync(path, msbuildLogger);

foreach (var unresolvedAnalyzer in project.AnalyzerReferences.OfType<UnresolvedAnalyzerReference>())
{
Logger.LogWarning($"There is .NET Analyzer that can't be resolved. "
+ $"If this analyzer is .NET Source Generator project. "
+ $"Try build with `dotnet build -c Release` command before running docfx. Path: {unresolvedAnalyzer.FullPath}");
}
}

if (!project.SupportsCompilation)
Expand Down

0 comments on commit f3dc21f

Please sign in to comment.