1
votes

Currently having the following errors on the "Complete the SonarQube analysis" step of our TFS 2017 build:

2017-12-05T22:04:24.5437340Z ##[error]System.Management.Automation.CommandNotFoundException: The term 'Get-TaskVariable' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

2017-12-05T22:04:24.5837397Z ##[error]System.Management.Automation.RuntimeException: The MSBuild.SonarQube.Runner executable could not be found. Check that the build definition includes a SonarQube Pre-Build step ---> System.Management.Automation.RuntimeException: The MSBuild.SonarQube.Runner executable could not be found. Check that the build definition includes a SonarQube Pre-Build step

SonarQube version: Version 6.7 (build 33306) SonarQube Scanner for MSBuild version: 3.0.2

The "Prepare the SonarQube Analysis" step completes prior to the Visual Studio build step with no errors.

1
Do you use the latest SonarQube components in the TFS build definition?Jeroen Heier

1 Answers

0
votes

According to the error seems SonarQube.Runner didn't captured by TFS build agent.

Double confirm the configuration in SonarQube Scanner for MSBuild - Begin Analysis task which used to prepare the analysis before executing the build. Such as SonarQube Endpoint.

Besides, on the build agent:

  • Make sure the .NET Framework v4.5.2+ is installed
  • Make sure the Java Runtime Environment 8 is installed

Source Link: Analyzing with SonarQube Extension for VSTS/TFS

Try to create a new build definition with a simple test project to see if got the same error.