1

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.

Kitt Holland
  • 83
  • 1
  • 1
  • 6

1 Answers1

0

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.

PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
  • .NET Framework verison 4.7, Java Version 8 Update 111 installed on the agent. I am going to try building a new build agent server to see if that helps. – Kitt Holland Dec 07 '17 at 16:48
  • @KittHolland Yes you should try these, since the system capabilities are only discovered when the agent is first configured -- any changes made after that are not captured. You need to reregister the build agent with TFS, https://stackoverflow.com/questions/43605989/tfs-2015no-agent-could-be-found-with-the-following-capabilities-msbuild-visua/43630905 – PatrickLu-MSFT Dec 08 '17 at 09:53
  • 1
    That's really good information, thanks. Can you update the capabilities or do you have to reinstall? I will diff the capabilities when I get back to the office to confirm. – Kitt Holland Dec 09 '17 at 16:30
  • @KittHolland You don't have to reinstall this. After reconfigured or reinstalled build agent, TFS will auto captured and update those new capabilities for the agent. – PatrickLu-MSFT Dec 11 '17 at 09:35
  • Hi @KittHolland, any update on this question, have you figured it out? – PatrickLu-MSFT Dec 26 '17 at 09:55