Resolve analyzers from the analyzers group in project.assets.json#54646
Draft
martinrrm wants to merge 1 commit into
Draft
Resolve analyzers from the analyzers group in project.assets.json#54646martinrrm wants to merge 1 commit into
martinrrm wants to merge 1 commit into
Conversation
|
|
||
| if (!IsApplicableAnalyzerLanguage(asset, projectCodeLanguage)) | ||
| { | ||
| _task.Log.LogMessage(MessageImportance.Low, $"Excluding analyzer '{asset.Path}' from package '{library.Name}' because its code language does not apply to the project language '{projectCodeLanguage}'."); |
Contributor
There was a problem hiding this comment.
Should this message be localized?
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.
Summary
This is the SDK (build) half of the "indicate analyzer assets in project.assets.json" feature (spec: NuGet/Home#14455). It teaches
ResolvePackageAssetsto consume the newanalyzersgroup that NuGet restore writes intoproject.assets.json, instead of scanning every file underanalyzers/in each package.Note
Draft until the companion NuGet restore change ships (NuGet/Home#6279). The local
NuGet.configandeng/Version.Details.propsedits in this branch point the build at a locally-built NuGet and must not be merged — they exist only to validate end-to-end against the in-progress restore change.What changes
When restore has recorded
RestoreEnableAnalyzerAssetsin the assets file (opt-in, gated to .NET 11+ on the restore side),ResolvePackageAssetsnow:analyzersgroup in each package's target rather than scanninglibrary.Files. The group already hasPrivateAssets/ExcludeAssets/IncludeAssetsapplied by restore.codeLanguagemust match the project language, or be language-agnostic (any);compilerApiVersionwins; if the project's compiler version is unknown, every variant is treated as version-agnostic.RestoreMetadata.RestoreEnableAnalyzerAssetspersisted in the assets file, because the .NET 11 TFM gate lives in NuGet's targets (not imported at build). When the feature is enabled but a package has noanalyzersgroup, the SDK does not fall back to legacy scanning.AnalyzerResolverscanning is used unchanged.-v detailed, matching the selection-tracing style used elsewhere in these tasks.