Repository navigation
Add a new command line switch to skip analyzer execution - #46669
Merged
3 commits merged intoAug 10, 2020
Merged
3 commits merged into
3 commits merged into
Conversation
Fixes dotnet#40926 This support was added to `Microsoft.CodeAnalysis.targets` (ships with VS) in VS2019 16.5: https://docs.microsoft.com/en-us/visualstudio/code-quality/disable-code-analysis?view=vs-2019. However, the MSBuild property is not respected from 'dotnet' builds where this targets file is not imported (see dotnet#40926 (comment) for details). This change moves the skip analyzers logic down to `Microsoft.Managed.Core.targets` and core compiler layer so it is respected for all builds. As per offline discussions with Jared and Chris, we can no longer skip analyzer execution from MSBuild by removing the "Analyzer" items as these can include source generators, which should never be skipped (at least there are no current scenarios where we want to skip generators). Hence, we are adding a new command line compiler switch `/skipAnalyzers`, optionally followed by a `+` or `-`, to allow skipping analyzers. I verified the end-to-end functionality works fine by locally building `Microsoft.Net.Compilers.Toolset.Package` NuGet package and referencing it in a project.
jaredpar
reviewed
Aug 10, 2020
Member
|
@chsienki is added to the review. #Closed |
jaredpar
approved these changes
Aug 10, 2020
| </Target> | ||
|
|
||
| <Target Name="_ComputeSkipAnalyzers" BeforeTargets="CoreCompile"> | ||
| <!-- First, force clear non-user facing property '_SkipAnalyzers'. --> |
Contributor
Author
|
Thanks for the quick reviews! |
|
Hello @mavasani! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
This was referenced Aug 26, 2020
This pull request was closed.
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.

Fixes #40926
This support was added to
Microsoft.CodeAnalysis.targets(ships with VS) in VS2019 16.5:https://docs.microsoft.com/en-us/visualstudio/code-quality/disable-code-analysis?view=vs-2019.
However, the MSBuild property is not respected from 'dotnet' builds where this targets file is not imported (see #40926 (comment) for details).
This change moves the skip analyzers logic down to
Microsoft.Managed.Core.targetsand core compiler layer so it is respected for all builds. As per offline discussions with Jared and Chris, we can no longer skip analyzer execution from MSBuild by removing the "Analyzer" items as these can include source generators, which should never be skipped (at least there are no current scenarios where we want to skip generators). Hence, we are adding a new command line compiler switch/skipAnalyzers, optionally followed by a+or-, to allow skipping analyzers.I verified the end-to-end functionality works fine by locally building
Microsoft.Net.Compilers.Toolset.PackageNuGet package and referencing it in a project.