No analysable projects were found. SonarQube analysis will not be performed

I’m using SonarQube 7.9.1 and Azure DevOps 2019 (with the SQ extension). I’m scanning a number of projects in this fashion with great success. My issue is I have a single VB.NET project that fails with the error:

2019-08-27T21:03:44.5485120Z ##[error]No analysable projects were found. SonarQube analysis will not be performed. Check the build summary report for details.
2019-08-27T21:03:44.5499259Z No analysable projects were found. SonarQube analysis will not be performed. Check the build summary report for details.
2019-08-27T21:03:44.5501743Z Generation of the sonar-properties file failed. Unable to complete SonarQube analysis.
2019-08-27T21:03:44.5503578Z ##[error]17:03:44.54  Post-processing failed. Exit code: 1

I’ve seen a couple of similar threads of this error but not a resolution. I would greatly appreciate any feedback.

1 Like

Hi,

Is that a .net core project ? Do you have it inside a .sln, or it’s just a .vbproj ?

Thanks.
Mickaël

It is not .net core - it is an older application. The dev team tells me it is a ‘website template instead of a web app’ - whatever that means?

We’ve poked at the build definition a bit (to build off the .sln) and now get this error instead:

The SonarQube MSBuild integration failed: SonarQube was unable to collect the required information about your projects.
Possible causes:

  1. The project has not been built - the project must be built in between the begin and end steps
  2. An unsupported version of MSBuild has been used to build the project. Currently MSBuild 14.0 and 15.0 are supported
  3. The begin, build and end steps have not all been launched from the same folder
  4. None of the analyzed projects have a valid ProjectGuid and you have not used a solution (.sln)
    14:28:41.225 Post-processing failed. Exit code: 1

The project looks to build correctly on my Azure Devops onprem build agent. It is running Visual Studio 2019, so I assume that is supported?

Thoughts?

If it’s a legacy web site (i.e. one that doesn’t have a project file) then it can’t be analysed with the Scanner for MSBuild. See the Known Limitations section in the S4MSB docs.

Thanks so much for this useful answer! Final question - if not supported via scanner with MSBuild - is there any SonarQube scenario it is supported?

Thanks much!
Blake

The short answer is very probably not. The longer answer with a couple of long-shot suggestions that you could try is as follows…

Our C#/VB rules are written as Roslyn analyzers, which means they need to be executed as part of the MSBuild phase by a Roslyn-based version of the compiler.

It’s been a long time since I looked at a web site project (and I don’t have an old enough version of VS installed to be able to create one to look at!), but I’ve had a look at some of the docs. A website project is normally compiled on the fly by the ASP runtime, but can be precompiled using aspnet_compiler.exe. Unfortunately, aspnet_compiler.exe doesn’t seem to support analysis of any kind. I’ve had a quick peek inside the exe, and it looks like it’s not using MSBuild to the build; it seems to be using the legacy System.CodeDom.Compiler framework classes directly.

I can think of two hacky approaches you could try, neither of which is particularly simple or guaranteed to work:
a) create a dummy MSBuild project purely for analysis purposes that references the files in the website directory. If you can cruft up a suitable project file that builds, you could then analyse that project using the Scanner for MSBuild. However, you might not be able to create a buildable project since the code generated by the aspnet_compiler.exe won’t be available.

b) use the aspnet_compiler to precompile the exe, then use the now-obsolete FxCop exe to analyse the binary(ies) that are produced. You’d have to install the community FxCop SonarQube plugin since FxCop is no longer supported by SonarSource.
However, you still don’t have an MSBuild project file so you still can’t use the Scanner for MSBuild. Instead, you’ve have to create an appropriate sonar-project.properties file and call the command line Sonar Scanner directly.

Of the two options, (a) would be better if you could get it to work. It’s probably slightly less effort, and at least you would be running our up to date C# analysis rules rather than the legacy FxCop rules.

I’d be interested to hear if you can get something working!

2 Likes

Thanks so much!

Hi There,

I am getting the same error in a .NET core project. I have it inside a .sln as well. Any suggestions?

Thanks,
Adam

Hi,

Which version of .NET core are you targeting ? And which version of the Scanner are you using ?

Thanks.

I’m actually searching for a solution on similar issue, as [Adam Calabrese] is facing.
I’m using .Net core 3ver and SQ 7.9 LTS.
I’m using SonarQube Scanner for MSBuild 4.8ver.

It says “do not have a valid ProjectGuid and were not built using a valid solution (.sln) thus will be skipped from analysis…

Here is my post: Sonarqube scanner for MSBuild. Awaiting for responses…

Thanks
Jay

Hi,

.NET Core projects that are not build along with a solution need a ProjectGuid in their csproj to be well taken into account during the analysis.

We are currently working at improving this.

Mickaël

1 Like

Hi,

Ah I see. Meanwhile, can we hang-on to any workaround solution?

Vyjayanth