SonarSource / sonar-scanner-msbuild

SonarScanner for .NET

Home Page:http://redirect.sonarsource.com/doc/msbuild-sq-runner.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix analysis on MacOSX with .NET 8 when begin runtime doesn't match with build runtime

antonioaversa opened this issue · comments

Issue identified in this community thread. Follow-up of #1728.

.NET 8 has introduced a breaking change on GetFolderPath, when SpecialFolder.LocalApplicationData is used.
(Other breaking changes have been introduced on GetFolderPath, on Linux as well. However, those haven't affected us.)

The breaking change produces analysis failures, for example in the following scenario:

  • When the Scanner for .NET is run on MacOSX against .NET 8, it places the targets file at the new location.
  • If the project build happens on a previous runtime (.NET 7 or earlier), MSBuild looks for the targets file at the old location.
  • As a result, Sonar Analyzers are not executed on the build.

The opposite scenario is also possible: the Scanner for .NET runs on .NET 7 or earlier, placing the targets file at the old location, and MSBuild runs on .NET 8, looking for the targets file at the new location.

On-hold, waiting for a dedicated sprint.