Skip to content

Analyzer fixes#724

Merged
AArnott merged 3 commits into
mainfrom
dev/andarno/analyzer-improvements
Jun 6, 2026
Merged

Analyzer fixes#724
AArnott merged 3 commits into
mainfrom
dev/andarno/analyzer-improvements

Conversation

@AArnott
Copy link
Copy Markdown
Member

@AArnott AArnott commented Jun 6, 2026

  • Beef up diagnostic messages
  • Add back analyzers package dependency
    This was a real pain. NuGet won't let us have a package dependency without an assembly reference. MSBuild RAR complains about conflicting assembly dependency versions when analyzers get mixed into the compilation of the main library, so I had to drop the compiler reference via an msbuild hack. That got docfx all bent out of shape so I had to hack it to keep the compiler reference when docfx is building. Finally, in the process of all this, the analyzers were applied to more test projects (which is a good thing) so I had to resolve or suppress more diagnostics.

Copilot AI review requested due to automatic review settings June 6, 2026 15:17
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the developer experience around VS-MEF analyzers by (1) clarifying analyzer diagnostic messages and (2) ensuring the analyzers/code fixes package is brought in as a NuGet dependency of Microsoft.VisualStudio.Composition, while working around a NuGet/MSBuild packing issue.

Changes:

  • Updated analyzer diagnostic message text to explicitly point users to the correct [MetadataView] attribute source.
  • Adjusted Microsoft.VisualStudio.Composition packaging/build wiring to keep the analyzers dependency while avoiding referencing the analyzer project output at build time (NuGet/Home#10312 workaround).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Microsoft.VisualStudio.Composition/Microsoft.VisualStudio.Composition.csproj Restores analyzers package dependency via ProjectReference and adds an MSBuild target to remove the reference output from resolved project references (packing workaround).
src/Microsoft.VisualStudio.Composition.Analyzers.CSharp/Strings.resx Improves diagnostic messages for VSMEF015/VSMEF016 by clarifying which [MetadataView] attribute to use.

The `ReferenceOutputAssembly` metadata was added recently to remove some compile warnings. But it also inadvertently dropped the analyzer package as a package dependency so that VS-MEF users no longer got analyzers by default.
@AArnott AArnott force-pushed the dev/andarno/analyzer-improvements branch from 972c343 to 1e497fd Compare June 6, 2026 17:53
This is a workaround for dotnet/docfx#11076
Copilot AI review requested due to automatic review settings June 6, 2026 18:43
@AArnott AArnott force-pushed the dev/andarno/analyzer-improvements branch from 6576875 to 1ec3f63 Compare June 6, 2026 18:44
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.

@AArnott AArnott enabled auto-merge June 6, 2026 19:28
@AArnott AArnott merged commit 01c3faa into main Jun 6, 2026
9 checks passed
@AArnott AArnott deleted the dev/andarno/analyzer-improvements branch June 6, 2026 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants