Github actions MsBuild not working

Good day, I’ve tried to use default approach to perform a workflow to trigger scan from github
In tutorial for “.NET” it shows how to configure for .NET Core applications but this approach does not work for .NET Framework projects

.
I also used this link to define a workflow but I’m probably stuck at “build-all” part, where I am not sure what to define in this file. Maybe there are samples purely for .NET framework applications for Github actions? Sincerely

Hey @syncltu! Welcome to the Community.

As noted in the documentation for the Scanner for .NET:

The flavor used to compile the Scanner for .NET (either .NET Framework, .NET Core or .NET) is independent of the .NET version the project you want to analyze has been built with. Concretely, you can analyze .NET Core code with the .NET Framework version of the Scanner. It’s only relevant depending on your OS, and on the versions of .NET SDKs that are installed on your build machine.

This means there’s nothing illegal about:

    shell: powershell
    run: |
      .\.sonar\scanner\dotnet-sonarscanner begin /k:"colin-mueller-sonarsource_dotnet-framework-docker-samples" /o:"colin-mueller-sonarsource" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
      MSBuild.exe dotnetapp-4.6.2/dotnetapp-4.6.2.sln
      .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"

So long as .NET Core 2.1+ is available on the runner (which it definitely should be), and you add a step in your workflow to configure the MSBuild path correctly.

Thanks for a reply. Because Im using Sonarcloud, I am not sure how to configure MSBuild path correctly unforunately

What I would suggest is that you make sure you have a working GitHub Actions workflow to build your code without SonarCloud, and then adapt the SonarCloud example to include your build steps.

Specifically, you’ll probably be interested in adding microsoft/setup-msbuild to your wrkflow.

Thanks You Colin, this was helpful. I managed to setup msbuild with github actions. If needed, I could share a sample project that already works

@syncltu It would be welcomed!