Skip to content
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

Merged

Conversation

cristian-ambrosini-sonarsource
Copy link
Contributor

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:

  • V1 is Visual Studio 2015 -> MsBuild 14
    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.
  • V2 is Visual Studio 2017 -> MsBuild 15
    Message: The analysis using MsBuild 15 is deprecated. Please update your pipeline to MsBuild 16 or higher.

@github-actions github-actions bot moved this from Review in progress to In progress in Best Kanban Jan 25, 2024
Copy link

sonarcloud bot commented Jan 26, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

Copy link

sonarcloud bot commented Jan 26, 2024

Quality Gate Failed Quality Gate failed

Failed conditions

94.1% Coverage on New Code (required ≥ 95%)

See analysis details on SonarCloud


<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" />
Copy link
Contributor Author

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@github-actions github-actions bot moved this from Review in progress to Review approved in Best Kanban Jan 26, 2024
@cristian-ambrosini-sonarsource cristian-ambrosini-sonarsource added this to the 9.19 milestone Jan 26, 2024
@cristian-ambrosini-sonarsource cristian-ambrosini-sonarsource added the Type: Improvement Making existing code better. label Jan 26, 2024
@andrei-epure-sonarsource andrei-epure-sonarsource merged commit b474e2c into master Jan 26, 2024
29 of 30 checks passed
Best Kanban automation moved this from Review approved to Validate Peach Jan 26, 2024
@andrei-epure-sonarsource andrei-epure-sonarsource deleted the cristian/improve-msbuild-deprecation-message branch January 26, 2024 16:13
@cristian-ambrosini-sonarsource cristian-ambrosini-sonarsource moved this from Validate Peach to Done in Best Kanban Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Improvement Making existing code better.
Projects
Best Kanban
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants