Analyzer fixes#724
Merged
Merged
Conversation
There was a problem hiding this comment.
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.Compositionpackaging/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.
972c343 to
1e497fd
Compare
This is a workaround for dotnet/docfx#11076
6576875 to
1ec3f63
Compare
olegtk
approved these changes
Jun 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.