System.IO.InvalidDataException: End of Central Directory record could not be found

(Patrick Delaney) #1

I’m trying to configure SonarQube Community EditionVersion 7.2.1 (build 14109) with TFS 2015 update 4. I’m doing this in my lab. The SonarQube server is a Bitnami VM. TFS is on another VM. I downloaded version 3.1 of the SonarQube extension and added it to TFS.
I created a SonarQube endpoint and added a Name, URL, and the token and clicked OK. I then navigated to the build definition in TFS and add two build steps, SonarQube for MSBuild - Begin Analysis and SonarQube for MSBuild - End Analysis. When I try to edit the SonarQube Endpoint in the step definition, There is nothing in the drop-down box. It remains yellow and I can’t add it.

I found an article online that said I could create it as a Generic type. I was able to add it with the following entries.
I called it generic, gave it the url of username was blank and password/token was my sonarqube token.

I no went back to the build definition to add the sonarqube steps. This time the Endpoint drop-down had the choice of generic which is what I called the endpoint. For Project Key and Project Name I called them msbuild-example. I then save the definition and got no errors.

I get the following error during the build:
Starting task: Fetch the Quality Profile from SonarQube

Executing the powershell script: C:\Agent\tasks\SonarQubePreBuild\1.0.35\SonarQubePreBuild.ps1
SonarQube Scanner for MSBuild 1.1
Default properties file was not found at C:\Agent\tasks\SonarQubePreBuild\1.0.35\MSBuild.SonarQube.Runner-1.1\SonarQube.Analysis.xml
Pre-processing started.
Preparing working directories…
Checking for updates…
Could not find a file on the SonarQube server. Url:
Failed to update the SonarQube Scanner for MSBuild binaries. Check the server url, verify that the C# plugin is correctly installed on the SonarQube server and that the SonarQube server has been restarted.
Pre-processing failed. Exit code: 1
Unexpected exit code received from batch file: 1

Finishing task: SonarQubePreBuild

Any thoughts

(Colin Mueller) #2


First red flag is the version of SonarQube Scanner for MsBuild being used. That’s a very old version. v3.1.0 of the TFS extension shipped with v4.0 of the scanner.

Do you happen to have tasks available that are named the same as the ones that you are using but appended with “(New)”?

Long story short: I believe TFS shipped with SonarQube tasks at one point, but those are now quite old, deprecated, and are marked as such in later versions of TFS (if not removed entirely by now). The old, built in tasks used a generic endpoint, while the new ones use an endpoint of type “SonarQube”. Since you were able to create the latter, I have faith the extension was installed correctly on your TFS instance.


(Patrick Delaney) #3

Thank you for you help. I checked our on-site TFS system and I see that when adding new tasks to a build definition there are 2. SonarQube for MSBuild - Begin Analysis and SonarQube for MSBuild - End Analysis. This system does not have the new TFS extension installed. I used those tasks in my testing. So my first question would be, is there a way to remove those from the available choices?

I will go back to my off-site test environment and add the try again, not using the steps above.
I will update you later.


(Patrick Delaney) #4

BAM — I removed the Endpoints that I originally created, and created a new one using the SonarQube New Service Endpoint definition. Then I added the correct Tasks to the build definition and now it works. Thank you so much.