Unable to resolve source directory

I am using SonarScanner for MSBuild 5.5.3
Microsoft (R) Build Engine version 16.11.2+f32259642 for .NET Framework.

I am trying to scan a solution which is having 6 projects. Report is generating successfully, but some files are missing in the report . When checked in the console it is saying that Unable to resolve source directory error for the missing files.

Can you please let me know what’s need to be be done here.
Can I scan a single file missed by including file in any xml.?

Hi,

Welcome to the community!

Can you share your analysis log?

The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.

This guide will help you find them.

 
Ann

Hi @ganncamp ,

Upon looking into logs found that related to encoding issue. Below is the scanner log.

Line 76271: WARN: Invalid character encountered in file ‘X’ at line 3428 for encoding UTF-8. Please fix file content or configure the encoding to be used using property ‘sonar.sourceEncoding’.

Line 76272: WARN: Encoding detected by Roslyn and encoding used by SonarQube do not match for file ‘X’. SonarQube encoding is ‘UTF-8’, Roslyn encoding is ‘windows-1252’. File will be skipped.

Encoding might be the reason which causes skipping the files. I have added below property to SonarQube.Analysis.xml, but on luck.

UTF-8

sonar.sourceEncoding = UTF-8

Could you please let me know, what’s causing the issue here.

Hi,

Without your analysis logs, I don’t have much to go on.

 
Ann