SonarCloud 404 error when running MSBuild not finding nuget sources

  • ALM used: GitHub.
  • CI system used: AWS CodeDeploy
    *** Scanner command used:** run: |
    ..sonar\scanner\dotnet-sonarscanner begin /k:“Org-Github” /o:“org-name” /d:sonar.token=“${{ secrets.SONAR_TOKEN }}” /d:sonar.host.url=“https://sonarcloud.io
    dotnet restore ${{ project-path }} -s https://api.nuget.org/
    ..sonar\scanner\dotnet-sonarscanner end /d:sonar.token=“${{ secrets.SONAR_TOKEN }}”

*** Languages of the repository**: C# .Net core
*** Error observed:**
Determining projects to restore…
Retrying ‘FindPackagesByIdAsyncCore’ for source ‘https://api.nuget.org/FindPackagesById()?id=‘coverlet.collector’&semVerLevel=2.0.0’.
Response status code does not indicate success: 404 (Not Found).
Retrying ‘FindPackagesByIdAsyncCore’ for source ‘https://api.nuget.org/FindPackagesById()?id=‘NUnit3TestAdapter’&semVerLevel=2.0.0’.
Response status code does not indicate success: 404 (Not Found).
Retrying ‘FindPackagesByIdAsyncCore’ for source ‘https://api.nuget.org/FindPackagesById()?id=‘Swashbuckle.AspNetCore’&semVerLevel=2.0.0’.
Response status code does not indicate success: 404 (Not Found).

…etc many of the above. Also the following errors:
D:\a\location path to one of the projects within the solution : error NU1301: Failed to retrieve information about ‘NUnit3TestAdapter’ from remote source ‘https://api.nuget.org/FindPackagesById()?id=‘NUnit3TestAdapter’&semVerLevel=2.0.0’. [D:\a\location path to one of the projects within the solution\SolutionName.sln]

also many of the above for every nuget package

Hey there.

Do you get these error when you don’t include any of the dotnet-sonarscanner steps?

No errors before.

What I’m getting at is: if you only leave this:

dotnet restore ${{ project-path }} -s https://api.nuget.org/

And remove

..sonar\scanner\dotnet-sonarscanner begin /k:“Org-Github” /o:“org-name” /d:sonar.token=“${{ secrets.SONAR_TOKEN }}” /d:sonar.host.url=“https://sonarcloud.io”

..sonar\scanner\dotnet-sonarscanner end /d:sonar.token=“${{ secrets.SONAR_TOKEN }}”```

Do you still receive the 404 errors. If so, it's not a SonarCloud issue, and I don't think we'll be able to help much. It's important to have a working GitHub Actions build, and then incorporate what is needed to execute SonarCloud analysis.

I tried running what you suggested, and I still get the 404 errors.