SonarAnalyzer failed on Windows with CS0006

Yes, you are right. I have to think about we can solve that.

The NUKE code (defines the build) is C# code, this should be clean code, checked by SQ etc.

Here is some additional information. I hope it helps:

c:\Users\s_TFSBuilder\.sonar\ is %userprofile%\.sonar (with s_TFSBuilder being the user account used on the agent).
It stores data that might be needed by multiple analyses and multiple scanners (even non-.NET scanners). For example, it caches analyzers and other artifacts downloaded by the scanner.

C:\Users\***\AppData\Local\Temp\.sonarqube or %temp%\.sonarqube is used by the Scanner for .NET (any flavor, .NET and .NET Framework) to prepare an analysis. The BEGIN step will copy the relevant files (most notably the analyzer DLLs) to this folder. It also acts as a cache because the BEGIN step will attempt to reuse files from this folder. However, the primary use is to store files used for analysis during the build.

c:\build\_work\979 is most likely the project’s build directory (compare Predefined variables - Azure Pipelines | Microsoft Learn).
The .sonarqube folder in the build directory contains the additional targets for the build and the configuration for the analysis.

The general process is as follows:

BEGIN:

  1. Download the needed analyzers or receive them from the cache in %userprofile%\.sonar.
  2. Prepares the analyzer files in %temp%\.sonarqube.
  3. If a project\.sonarqube folder exists (from a previous run), clean it.
  4. Prepare the project\.sonarqube folder. Link the analyzer files in project\.sonarqube\conf\SonarQubeAnalysisConfig.xml.

Build:

  1. Pickup additional targets from project\.sonarqube\bin\targets.
  2. Follow the links in project\.sonarqube\conf\SonarQubeAnalysisConfig.xml to include the analyzer files from %temp%\.sonarqube.
  3. Write the analysis results to project\.sonarqube\out.

END:

  1. Get the analysis results from project\.sonarqube\out.
  2. Upload them to the SonarQube server.
  3. Remove the targets from project\.sonarqube\bin\targets (but leave the rest of the folder untouched).

Good luck!