# SonarQube impacting seperate agent job?

**URL:** <https://community.sonarsource.com/t/sonarqube-impacting-seperate-agent-job/12328>\
**Category:** SonarQube Cloud\
**Tags:** azuredevops-services\
**Created:** [July 25, 2019, 9:58am UTC](https://community.sonarsource.com/t/sonarqube-impacting-seperate-agent-job/12328 "2019-07-25T09:58:41Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![duncanp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/duncanp/32/293_2.png) [@duncanp](https://community.sonarsource.com/u/duncanp)\
**Post date:** [October 16, 2019, 11:32am UTC](https://community.sonarsource.com/t/sonarqube-impacting-seperate-agent-job/12328/13 "2019-10-16T11:32:28Z")

</div>

Hi @Jody_Lester,

The scanner `begin` step copies files to two locations:

1. `SonarQube.Integration.ImportBefore.targets` is copied to machine-wide, user-specific locations, and it will be picked up by all builds run on the machine for all agents.
2. `SonarQube.Integration.targets` and its related assemblies are copied to a pipeline-specific location (`[build pipeline folder]\.sonarqube\bin\targets`)

Both sets of files need to be present for the Sonar analysis tasks and targets to be picked up and run as part of an MSBuild run. The error message you are seeing is coming from the `SonarQube.Integration.targets` file, which means that both the shared-location and pipeline-specific files are present at the point your database project is being built.

On a machine with a single build agent installed the sequence of steps would be as follows:  
(1) Agent 1 starts Analysis Build X -\> installs the shared targets and targets under `PipelineX\.sonarqube\...`  
(2) Agent 1 runs MSBuild -\> Sonar targets are executed  
(3) Agent 1 runs analysis end step -\> the targets in the shared location are deleted  
(4) Agent 1 runs the Redgate DB step -\> the shared targets are not on the machine -\> Sonar targets are not executed, so no error.

However, if the machine has multiple build agents installed then it’s possible for the following to happen:  
(3a) Agent 2 starts Analysis Build Y -\> installs the shared targets and targets under `PipelineY\.sonarqube\...`

Then at stage (4) for Agent 1 both shared targets and those under `PipelineX\.sonarqube\...` are present -\> Sonar targets are picked up the the Redgate DB build -\> error.

Try the following: add a script step in the `Build Query Intelligence Database` job immediately before the `Build SQL Change Automation Project Intelligence` step that deletes the pipeline-specific targets in `[AGENT_BUILDDIRECTORY]\.sonarqube\bin\targets`.

---

_[View the full topic](https://community.sonarsource.com/t/sonarqube-impacting-seperate-agent-job/12328)._
