Issue
Our Sonar Build Environment details as follows:
• SonarQube Server Version - 5.6.6 (64-Bit).
• Sonar-scanner- Version - 3.0.3.778.
• SonarQube Server Operating System – Ubuntu 14.04.5 LTS (64-Bit).
• sonar-csharp-plugin-5.11.0.1761.jar
• Sonar Build Machine OS – Windows-7(64-bit)
Problem Description:
I am scanning .cs files through sonar-scanner. Whereas it finishes successfully, But it is not providing proper result over dashboard. Means it shows below warning message and also under C-sharp Project-->Code(Tab) Lines of code also shows zero.
WARN: Encoding detected by Roslyn and encoding used by SonarQube do not
match for file D:\Jenkins\workspace\project-scm \system\SCM-Model.cs.
SonarQube encoding is 'windows-1252', Roslyn encoding is 'UTF-8'. File will be skipped.
Is there any way to resolve the same?
Solution
To solve this issue, open the file, save it without further changes to a the same file but now with UTF-8 encoding. One editor that let you do this is Visual Studio. See also this SO question. Start the analysis again and your warnings should be gone.
Answered By - Jeroen Heier