TFS 2017 + Sonarqube - tfs

We have a on prem installation of TFS (TFS 2017) and I am attempting to integrate SonarQube analysis into our build steps. I have installed the SonarQube extension on the TFS server and added a service endpoint to point to a server where I have SonarQube Server installed and configured.
When I attempting to trigger a build, I am getting an error "No agents could be found with the following capabilities: msbuild, java, visualstudio". Does my build server need JRE to be installed to get the SonarQube build steps to work? SonarQube website says this:
**Installation
Make sure the .NET Framework v4.5.2+ is installed
Make sure the Java Runtime Environment 8 is installed
Install the extension from the marketplace**

Both the error message and the documentation told you the same thing: You need Java installed.
I will be the third source of confirmation: You need Java installed.

First, the official document is very clear here: Make sure the Java Runtime Environment 8 is installed
Besides, according to your prompting error message:
No agents could be found with the following capabilities: msbuild,
java, visualstudio
You are also lacking msbuild, visualstudio. Not only need Java installed, but also need Visual Studio installed on your build agent, then restart the build agent. Restarting the build agent will capture the added Capabilities. If this not work, reconfigure the build agent should do the trick.
The build agent will not detect the environment changes after you installed it. It will only detect during the installation. If you are using vNext build agent, also try to manually add some capabilities in Settings- Agent Queues- Agent Pool - Agent- Capabilities. After this trigger the build again.
Note: if you are running on TFS earlier than 2017 Update 2, you will need to download and manually install the latest 3.x version of the VSIX to install SonarQube Extension.

Related

sonarqube 8.9.2 with tfs 2015 build integration - is it posible?

I'm using sonarqube 8.9.2 and TFS2015 update 4.
in 8.9.2 there is no c# plugin as it's built-in.
when trying to run the sonarqube step of the build I get an error saying the SonarQube.MSBuild.Runner.Implementation.zip is missing.
##[error]Could not find a file on the SonarQube server. Url: http://XXXXXXXXXX/static/csharp/SonarQube.MSBuild.Runner.Implementation.zip
2021-09-02T14:34:22.7202456Z ##[error]Failed to update the SonarQube MSBuild Runner 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.
2021-09-02T14:34:22.7202456Z ##[error]Pre-processing failed. Exit code: 1
2021-09-02T14:34:22.7360027Z ##[error]Unexpected exit code received from batch file: 1
the only thing I can find in the configuration is the Azure DevOps configuration in the ALM section but I'm using a local TFS 2015.
I've seen this post and the relevant answer but in 8.9 there is no C# plugin - Not able to integrate TFS 2015 with SonarQube
is it possible to integrate?
p.s,
I tried working with an older version of sonarqube (7.9.X) only to find there are issues with compatibility.
I installed v9 only to find that there is a bug in the latest releases and it will not start.
getting sick of this and starting to think I need to build a script that will run it manually.
thanks for your help,
Shay

TFS 2015 - Build failed due to exception in the test assemblies

I am trying to run a newly created Build in TFS but i am getting an error as shown in the screenshot below :
Build Configuration
I tried to debug the Unit Test project on my machine and even on the TFS server, it worked fine. So i am not able to understand if there is any configuration missing or issue in the test assemblies code?
Update
Since VS is installed after the build agent configured. Then reregister the build agent with TFS, since the system capabilities are only discovered when the agent is first configured -- any changes made after that are not captured.
First you could also Enable Verbose Debug Mode for TFS Build vNext by add system.debug=true to get more detail log info for trobuleshooting.
According to your build log and configuration, the error occurs after code coverage warning.
Try to uncheck the code coverage option and trigger the build again.
As a prerequisite to using Code Coverage, the first thing to do is to install Visual Studio Enterprise version on the build agent.
I had installed Build Agent before installing Visual Studio. Re-configuring the Build Agent resolved the issue.

TFS 2015:No agent could be found with the following capabilities: msbuild, visualstudio, vstest

We have recently upgraded to TFS 2015 Update 4. When I tried to do a build, I am getting the following error:
There are issues with the request or definition that may prevent the build from running:No agent could be found with the following capabilities: msbuild, visualstudio, vstest Queue the build anyway?
I tried the workaround mentioned in this link, but still couldn't figure out.
I have installed VS 2017 Enterprise in the Build Machine. Note, that since this is a POC I have installed Build Agent on the TFS Server itself.
Should anything extra be need to be installed? Please help.
TIA
You could double check if you are missing some capabilities such as VSTEST_15.0 for the build agent.
Settings- Agent Queues- Agent Pool - Agent- Capabilities
If the test related capabilities are missing, you could try to reregister the build agent. Or manually add the capabilitie by select +.
Recently I had the same issue: installed VS2017, configured build agent, visualstudio and msbuild capabilities missing.
Try installing VS2015 next to VS2017. Re-configure the build agent after this (in my case, I completely removed all the old _diag, _work and settings.json data as well). This fixed the issue for me, the missing capabilities were now recognized.
I was getting the same error out of the blue and it was running fine the previous week.
Restarting the build agent service resolved the error for me

SonarQube VSTS Marketplace Extension

I downloaded the extension from
https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarqube#review-details,
for TFS 2015 on premise, installed it in my collection and created and end point. Then I configured 2 steps as indicated before and after my build, I am getting the following error
[error]The MSBuild.SonarQube.Runner executable could not be found. Check that the build definition includes a SonarQube Pre-Build step
My sonar server Version is 5.6.3 running on Linux fedora. Do I need to install any other tools? I understand that The SonarQube Extension embeds its own version of the SonarQube Scanner for MSBuild. The first step before the build executes correctly, the build succeed but the end step fails.
Thanks in advance for your help

Error 'No agent could be found with the following capabilities: msbuild, visualstudio, vstest'

I'm setting up a new build server using TFS 2015 and after I configured the agent, when I tried to queue a build I got this error:
No agent could be found with the following capabilities: msbuild, visualstudio, vstest
How can this be resolved?
Install Visual Studio on your build agent, then restart the build agent. Restarting the build agent will capture the added Capabilities.
Note: First of all, you can do all this with the community edition and TFS Express 2015 on your own server (for free up to five users) - so don't worry about needing to use the Visual Studio online version or paying for Visual Studio Professional.
It is very easy to misinterpret the error message provided and go off on a wild-goose chase trying to debug it.
Unfortunately the message itself is just badly worded and that's the real problem.
Here is what that error message really means:
"No agent could be found with the following capabilities: msbuild,
visualstudio, vstest.
In fact I didn't actually find ANY build agents configured for the selected build queue."
So you're thinking that doesn't apply to you because you just created a build agent?
Well, maybe you did, but here's what probably happened:
You created a new pool (for no reason other than you just thought you ought to).
You then created a queue under that pool.
You ran the PowerShell script to create an agent and you assumed it put it in the pool you just created....
But it didn't - it put it in the 'default' pool which you aren't even using...
Aha!
So here's what happens when you build:
You select a queue from the dropdown.
TFS tries to build by looking for the pool that corresponds to that queue and it doesn't find any agents AT ALL there, so you get a stupid useless red-herring error message.
When I finally realized what happened I just deleted my cutely named pool + queue and just reverted to using the default pool.
Next time I will try to pay more attention to this message during the PowerShell configuration:
Configure this agent against which agent pool? (default pool name is
'default')
You will have to create a queue under the pool, but then your agent should start working.
If you have a genuine with a certain capability being absent from your agent you can check what your agent supports via the 'capabilities' tab shown here. Of course msbuild, visualstudio and vstest are all here :-)
In my case, after installing MSBuild (https://www.visualstudio.com/downloads/, search for "Build Tools for Visual Studio 2017"), I just had to add the path to MSBuild to the PATH environment variable. The agent wasn't detecting MSBuild until I did that.
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin
I did NOT have to install the full Visual Studio IDE. The selected answer for this question is just plain wrong...
By default, when using the new build system on VSO, it doesn't pick the hosted build option, which is how I ended up on this post in Stack Overflow. If you are used to using a VSO build server here's what you need to do:
Create a hosted build by going to the General tab and changing your Default Queue to hosted. More on the restrictions of that and how it works here: https://www.visualstudio.com/get-started/build/hosted-agent-pool
Add them as User-defined capabilities, e.g.:
visualstudio C:\Program Files\Microsoft Visual Studio\2022\Community
vstest C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow
I had initially installed the agent on a machine that did not have Visual Studio installed. However, after installing Visual Studio (and then Visual Studio Build Tools), restarting/recreating my agent, restarting my machine, etc., I could not get the agent to detect the new capabilities automatically, so I added them myself in Azure DevOps as User-defined capabilities.
I had this issue and it turned out being my release process had selected the "wrong" agent. Just edit the release and set the correct agent queue
I was using a Xcode build slave for building an Xcode project.
And the error message I ended up with in TFS 2015 was
"No agent could be found with the following capabilities: xcode"
I registered an OS X on-premise build slave.
In the "Register Agent" step, I named by build agent:
>> Register Agent:
Enter agent pool (press enter for default) > My-Xcode-Agent-Pool
So, I had to select the "My-Xcode-Agent-Pool" as Default queue in the build settings. Source: Microsoft-hosted agents
Although none of previous answers worked for me, the post by Simon_Weaver pointed me in the right direction.
He mentioned that vstest was in his list, but it wasn't in mine. I fixed it by adding a user-defined capability named "vstest" with the full path to vstest.console.exe under Visual Studio 2017.
What ended up working for me was to go to where I downloaded the agent and running:
./config.cmd remove then ./config.cmd to reinstall the agent from the command line inside the directory of my agent.
Download agent
per microsoft https://msdn.microsoft.com/en-us/ie/bb399135(v=vs.94)
You must install on the build agent the version of Visual Studio that your team uses on its dev machines. See Installing Visual Studio. You must also install any other software and components that are installed on your dev machines and that are required to build your app.
In my case, after installing MSBuild, restart all Azure services (in windows service) and it worked. No need to install full Visual Studio
You have to install the correspondent Visual Studio version on the build machine (where you have installed your agent). This will add the required tools and capabilities to the server.
Visual Studio is required, because it installs all the build targets required to build your projects.
After being installed, you have to restart the agent Windows service so that it refreshes the list of capabilities.
Since you are using the Visual Studio installation on the build machine to build, that installation doesn't count as an additional license.
General solution for TFS:
The common way of resolving most of the issues on the build server is to install Visual Studio & all dependent packages on your build server.
Alternative solution in case of using VSTS
When you choose where to build, use "Hosted"
and then the build will work.
The guide how to make it work may be found here: Deploy an agent on Windows for TFS 2015
Check the agent section which will contain information about capabilities.
Updated:
Once you have the list of capabilities in vsts(azuredevops)
you might need to install the desired software on your build agent machine.
PS Be aware, you might have to license your sw, if required.

Resources