AnalysisWarningAnalyzerBase: targeted warnings for MSBuild14/15#8609
Merged
andrei-epure-sonarsource merged 6 commits intomasterfrom Jan 26, 2024
Merged
Conversation
costin-zaharia-sonarsource
requested changes
Jan 25, 2024
analyzers/src/SonarAnalyzer.Common/Rules/Utilities/AnalysisWarningAnalyzerBase.cs
Outdated
Show resolved
Hide resolved
analyzers/tests/SonarAnalyzer.Test/Rules/Utilities/AnalysisWarningAnalyzerTest.cs
Outdated
Show resolved
Hide resolved
|
|
| <ItemGroup> | ||
| <!-- This will enforce using Roslyn 1.3.1 --> | ||
| <!-- This will enforce using Roslyn 2.4.0 --> | ||
| <PackageReference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" Version="1.0.8" /> |
Contributor
Author
There was a problem hiding this comment.
Microsoft.CodeDom.Providers.DotNetCompilerPlatform version 1.0.8 was actually enforcing Roslyn version 2.4.0, thus raising the MSBuild15 deprecation warning.
I created another test project with a DotNetCompilerPlatform package version 1.0.3 that's enforcing Roslyn version 1.3.2 to generate and test the MSBuild14 phase-out support warning.
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.


AnalysisWarningAnalyzerBase.cs creates AnalysisWarnings.MsBuild.json and logs a warning that MsBuild 14 and 15 are deprecated. It does this by checking if the Roslyn version is lower than 3, which is associated with MsBuild 16.
The goal of this PR is to differentiate between MsBuild 14 and 15 and show different messages.
We are achieving this by checking the Roslyn version:
Message:
The analysis using MsBuild 14 is no longer supported and the analysis with MsBuild 15 is deprecated. Please update your pipeline to MsBuild 16 or higher.Message:
The analysis using MsBuild 15 is deprecated. Please update your pipeline to MsBuild 16 or higher.