Skip to content

AnalysisWarningAnalyzerBase: targeted warnings for MSBuild14/15#8609

Merged
andrei-epure-sonarsource merged 6 commits intomasterfrom
cristian/improve-msbuild-deprecation-message
Jan 26, 2024
Merged

AnalysisWarningAnalyzerBase: targeted warnings for MSBuild14/15#8609
andrei-epure-sonarsource merged 6 commits intomasterfrom
cristian/improve-msbuild-deprecation-message

Conversation

@cristian-ambrosini-sonarsource
Copy link
Contributor

@cristian-ambrosini-sonarsource cristian-ambrosini-sonarsource commented Jan 25, 2024

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.

@sonarqubecloud
Copy link

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

@sonarqubecloud
Copy link

sonarqubecloud 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

<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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants