Project indicates "The main branch of this project is empty."

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    sonarqube-8.9.0.43852
    sonar-scanner-3.3.0.1492
    SonarScanner for MSBuild 4.6.2

  • what are you trying to achieve
    Get results for one of our Sonar projects. The other 7 projects (C# and C++) all produce results. This is a .Net project that indicates the project is empty.

  • what have you tried so far to achieve this

Ran the following commands from a command prompt:

SonarScanner.MSBuild.exe begin /k:“FTA-EasyActivate” /d:sonar.host.url=“http://localhost:9000” /d:sonar.login=“d66c0714fc4765e939a2fa6ed2c65b2d25be1416” /d:sonar.cfamily.build-wrapper-output=“bw_output”
SonarScanner.MSBuild.exe begin /k:“FTA-EasyActivate” /d:sonar.host.url=“http://localhost:9000” /d:sonar.login=“d66c0714fc4765e939a2fa6ed2c65b2d25be1416” /d:sonar.cfamily.build-wrapper-output=“bw_output”
SonarScanner.MSBuild.exe end /d:sonar.login=“d66c0714fc4765e939a2fa6ed2c65b2d25be1416”

The results of FTA-EasyActivate (vs. the other projects) is shown in the image.

The FTA-EasyActivate results are:


Hi,

Welcome to the community!

Is it possible that analysis thinks this is a test project?

 
HTH,
Ann

What do I look for that indicates this particular project is a ‘test project’? I don’t see a difference between the way FTA-EasyActivate is using SonarQube and FTA-AdopterDllSource. How do I tell the analyzer that FTA-EasyActivate is not a ‘test project’? Do I add something to the bottom of the SonarQubeAnalysisConfig.xml for FTA-EasyActivate such as:

<PropertyGroup>
  <!-- Project is not a test project -->
  <SonarQubeTestProject>false</SonarQubeTestProject>
</PropertyGroup>

?

I tried:
SonarScanner.MSBuild.exe begin /k:“FTA-EasyActivate” /d:sonar.host.url=“http://localhost:9000” /d:sonar.login="d66c0714fc4765e939a2fa6ed2c65b2d25be1416” /d:sonar.cfamily.build-wrapper-output=“bw_output” /d:sonar.dotnet.excludeTestProjects=false

build-wrapper-win-x86-64.exe --out-dir bw_output MSBuild.exe /t:Rebuild EasyActivate.sln

SonarScanner.MSBuild.exe end /d:sonar.login=“d66c0714fc4765e939a2fa6ed2c65b2d25be1416” /d:sonar.dotnet.excludeTestProjects=false

with no change in behavior.

How should I specifiy that FTA-EasyActivate is not a test project?

Hi,

Is this a C# or a C++ project? (Or both?)

 
Ann

BTW, you’ve already revoked that token you just published to the internet, right.

 
:wink:
Ann

It is C#. I do not understand what you mean by ‘token you just published to the internet’. Let me know if I am doing some incorrectly.

Hi,

If there’s no C or C++ code, then you don’t need to use the build wrapper.

Could you share your analysis logs, starting from the begin command?

Regarding your token, I’m talking about your sonar.login value. You should revoke that token.

 
Ann

I have been running the three commands (begin, build and end) as listed above.
The outputs of the three commands are in the attached .zip file (‘BeginStep.out’, ‘BuildStep.out’ and ‘EndStep.out’)
SonarQubeEasyActivateIssue.zip (6.8 KB)
.

Hey there.

The version of the Scanner for .NET you’re using (v4.6.2) is more than 3 years old.

As a first step, I would suggest using the latest version (v5.6.0). Otherwise, things look like they are in order in your build.

Thank you. Using v5.6.0 of the Scanner for .NET corrected the issue.

2 Likes