-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AnalysisWarningAnalyzerBase: targeted warnings for MSBuild14/15 #8609
AnalysisWarningAnalyzerBase: targeted warnings for MSBuild14/15 #8609
Conversation
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
|
|
|
||
<PropertyGroup> | ||
<TargetFramework>net48</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<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" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
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.