Rule for avoiding pre-release packages in C#?

Hi there, @themathmagician, @Corniel

If you use the new v8+ version of the scanner for .Net (v8.0.2 at the time of this post), it will automatically find all files that can be analyzed by one of our languages.

Since csproj is an XML-based file, you can add the extension to the set of extensions for XML file.
Doing this, any issue raised by any roslyn analyzer on the csproj file will be automatically included in the SonarCloud analysis.

In Short:

  1. In SonarCloud, in your project’s General Settings (from the administration menu at the bottom left), in the languages section, choose the XML language and add .csproj as an extension
  2. Include the package @Corniel gave a reference to, commit and push

You should see the issues detected by the analyzer as new issues once the analysis completes.

Please note: if Sonar decides to create rules on csproj, we will have to claim the .csproj extension for the csharp language, which will create an error if you have mapped it to a different language. In that case, you will have to remove the extension from the XML language.

Denis