Clarification on GitHub Action and .Net please

I looked at the GitHub Action (https://github.com/SonarSource/sonarcloud-github-action) for my workflow and the notes are (to me) a little ambiguous. Specifically the following;

Do not use this GitHub action if… You want to analyze a .NET solution: use the SonarCloud Azure DevOps Extension to analyze your code on SonarCloud with Azure Pipelines

Because of the confusing versioning in .Net (.Net Framework, .Net Standard, .Net Core, .Net 5) I’m not sure if this simply means “Don’t use this for C# at all” or “we don’t support Windows .Net 4.x but might support cross platform 5.x”. The use of “solution” confuses me as well, does that mean that a single .csproj file can be built? I doubt it, but I just want to be sure.

The reason I ask is because I’d love to use the Action as I’m not going to commit to Azure Pipelines which I believe they’ll be deprecating in favour of Actions at some point.

I did see another build.yml example for Windows (https://github.com/SonarSource/sonarcloud-github-action-samples/blob/dotnet/.github/workflows/build.yml) but I’d like to use an Ubuntu image if possible to keep the build sprightly and cross platform.

My questions boil down to;
Does the GitHub Action support any .Net flavour? If not, is there the possibility in future of it supporting .Net 5 as that is cross platform? Happy to put some effort in here but I may be of limited use.

Thanks for reading!

Ryan

Hey Ryan

I had a similar issue when moving my personal repos from DevOps to GitHub.

I’m not sure if this simply means “Don’t use this for C# at all” or “we don’t support Windows…"

No support for any flavour of .NET in GitHub Actions as yet.

There are a few custom GitHub Action tasks that can run the scan for you in a Docker Container and report a quality gate and do branch/PR analysis for you. The one I ended up going with was this: https://github.com/highbyte/sonarscan-dotnet. My implementation: https://github.com/KrylixZA/Shared-WebApi-Core/blob/master/.github/workflows/ci.yml#L67

Unfortunately there is nothing official yet but these alternatives seem to work okay. It does mean you do a double build as you can’t use the Docker container to build and publish NuGet packages or push to a Docker registry or anything like that. So a full solution from Sonar Source wouldn’t go amiss and I’m sure it’s in the pipeline.

3 Likes

Thank you Simon, that’s very helpful.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.