Description:
I am running SonarScanner for MSBuild in my GitHub Actions workflow, but it fails with the following error:
SonarScanner for MSBuild 9.0.2
Using the .NET Core version of the Scanner for MSBuild
Unable to read the analysis settings file '/home/runner/work/avro-adapter/avro-adapter/sonar-project.properties'.
Please fix the content of this file.
Loading analysis properties from /home/runner/work/avro-adapter/avro-adapter/sonar-project.properties
Error: Process completed with exit code 1.
Steps I am following:
Here is the relevant part of my workflow:
yaml
dotnet-sonarscanner begin /k:"<project KEY>" \
/o:"<organisation key>" \
/d:sonar.token="${{ secrets.SONAR_CLOUD_TOKEN }}" \
/d:sonar.cs.analyzeGeneratedCode=true \
/d:sonar.host.url="https://sonarcloud.io" \
/d:sonar.verbose=true \
/d:sonar.scanner.scanAll=false \
/s:"/home/runner/work/avro-adapter/avro-adapter/sonar-project.properties"
dotnet clean
dotnet build --no-incremental
dotnet publish -c Release -o avro-adapter/bin/Release/netcoreapp3.1/publish
dotnet test --collect "Code Coverage"
dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_CLOUD_TOKEN }}"
What I have checked so far:
- File existence & permissions:
ls -l /home/runner/work/avro-adapter/avro-adapter/sonar-project.properties
confirms the file exists with-rw-r--r--
permissions.
- File encoding:
- Checked with
file -bi
and confirmed it’s UTF-8.
- Property file correctness:
- Contents of
sonar-project.properties
:
sonar.projectKey=<proj key>
sonar.organization=<org key>
sonar.host.url=https://sonarcloud.io
sonar.sources=.
sonar.cs.analyzeGeneratedCode=true
sonar.verbose=true
- Removed
sonar.language=cs
as it is deprecated. - Ensured there are no extra spaces or invalid characters.
Question:
What could be causing this issue? Are there any additional debugging steps I can try?
Thanks in advance for any help!