SonarSource / sonar-scanner-msbuild

SonarScanner for .NET
http://redirect.sonarsource.com/doc/msbuild-sq-runner.html
GNU Lesser General Public License v3.0
365 stars 142 forks source link

Support relative path in explicit ErrorLog value #1074

Open pavel-mikula-sonarsource opened 3 years ago

pavel-mikula-sonarsource commented 3 years ago

Description

1015 fixed an issue that the explicit ErrorLog property provided by a user wasn't handled properly. Since 5.3.0 we do accept user-provided values.

Problem is that we only support absolute paths now because ErrorLog could be relative to the project directory. Such value gets propagated to the ProjectInfo.xml as a relative path but they don't share the same base when processing.

Originally reported on community forum

Reproducer

To reproduce the issue, add relative ErrorLog property to a project file:

<ErrorLog>obj\issues.json</ErrorLog>

Then end step will produce a warning:

WARN: No Roslyn issue reports were found. The C# files have not been analyzed. You can get help on the community forum: https://community.sonarsource.com

Workaround

To workaround the issue, you can set absolute path in the ErrorLog property:

<ErrorLog>$(MSBuildProjectDirectory)\obj\issues.json</ErrorLog>
pavel-mikula-sonarsource commented 3 years ago

The same issue affects the Razor property as well.

andrei-epure-sonarsource commented 2 years ago

should this be supported in the S4NET or rather in the SQ plugin @pavel-mikula-sonarsource ?

pavel-mikula-sonarsource commented 2 years ago

This should be fixed on S4NET side as the target file also contains the ultimate source of truth about the base path that the ErrorLog is relative to.