SonarQube impacting seperate agent job?

Hi @Jody,

Yes, the scanner begin step will copy the targets to several locations under AppData:

SonarScanner for MSBuild 4.7.1
Using the .NET Framework version of the Scanner for MSBuild
...
Pre-processing started.
Preparing working directories...
Using environment variables to determine the download directory...
Using environment variable 'AGENT_BUILDDIRECTORY', value 'd:\a\1'
13:14:15.933  13:14:15.933  Loading analysis properties from d:\a\_tasks\SonarCloudPrepare_14d9cde6-c1da-4d55-aa01-2965cd301255\1.9.0\classic-sonar-scanner-msbuild\SonarQube.Analysis.xml
13:14:15.933  13:14:15.933  sonar.verbose=true was specified - setting the log verbosity to 'Debug'
13:14:16.167  Updating build integration targets...
13:14:16.183  Installed SonarQube.Integration.ImportBefore.targets to C:\Users\VssAdministrator\AppData\Local\Microsoft\MSBuild\4.0\Microsoft.Common.targets\ImportBefore
13:14:16.183  Installed SonarQube.Integration.ImportBefore.targets to C:\Users\VssAdministrator\AppData\Local\Microsoft\MSBuild\10.0\Microsoft.Common.targets\ImportBefore
13:14:16.183  Installed SonarQube.Integration.ImportBefore.targets to C:\Users\VssAdministrator\AppData\Local\Microsoft\MSBuild\11.0\Microsoft.Common.targets\ImportBefore
13:14:16.183  Installed SonarQube.Integration.ImportBefore.targets to C:\Users\VssAdministrator\AppData\Local\Microsoft\MSBuild\12.0\Microsoft.Common.targets\ImportBefore
13:14:16.183  Installed SonarQube.Integration.ImportBefore.targets to C:\Users\VssAdministrator\AppData\Local\Microsoft\MSBuild\14.0\Microsoft.Common.targets\ImportBefore
13:14:16.183  Installed SonarQube.Integration.ImportBefore.targets to C:\Users\VssAdministrator\AppData\Local\Microsoft\MSBuild\15.0\Microsoft.Common.targets\ImportBefore
13:14:16.183  Installed SonarQube.Integration.ImportBefore.targets to C:\Users\VssAdministrator\AppData\Local\Microsoft\MSBuild\Current\Microsoft.Common.targets\ImportBefore
13:14:16.183  Installed SonarQube.Integration.targets to d:\a\1\.sonarqube\bin\targets

The targets are removed in the end step:

[command]d:\a\_tasks\SonarCloudPrepare_14d9cde6-c1da-4d55-aa01-2965cd301255\1.9.0\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe end
SonarScanner for MSBuild 4.7.1
Using the .NET Framework version of the Scanner for MSBuild
Post-processing started.
13:19:21.084  13:19:21.021  Uninstalling target: C:\Users\VssAdministrator\AppData\Local\Microsoft\MSBuild\4.0\Microsoft.Common.targets\ImportBefore\SonarQube.Integration.ImportBefore.targets
13:19:21.084  13:19:21.021  Uninstalling target: C:\Users\VssAdministrator\AppData\Local\Microsoft\MSBuild\10.0\Microsoft.Common.targets\ImportBefore\SonarQube.Integration.ImportBefore.targets
13:19:21.084  13:19:21.021  Uninstalling target: C:\Users\VssAdministrator\AppData\Local\Microsoft\MSBuild\11.0\Microsoft.Common.targets\ImportBefore\SonarQube.Integration.ImportBefore.targets
13:19:21.084  13:19:21.021  Uninstalling target: C:\Users\VssAdministrator\AppData\Local\Microsoft\MSBuild\12.0\Microsoft.Common.targets\ImportBefore\SonarQube.Integration.ImportBefore.targets
13:19:21.084  13:19:21.021  Uninstalling target: C:\Users\VssAdministrator\AppData\Local\Microsoft\MSBuild\14.0\Microsoft.Common.targets\ImportBefore\SonarQube.Integration.ImportBefore.targets
13:19:21.084  13:19:21.021  Uninstalling target: C:\Users\VssAdministrator\AppData\Local\Microsoft\MSBuild\15.0\Microsoft.Common.targets\ImportBefore\SonarQube.Integration.ImportBefore.targets
13:19:21.084  13:19:21.021  Uninstalling target: C:\Users\VssAdministrator\AppData\Local\Microsoft\MSBuild\Current\Microsoft.Common.targets\ImportBefore\SonarQube.Integration.ImportBefore.targets
13:19:21.084  13:19:21.084  sonar.verbose=true was specified - setting the log verbosity to 'Debug'

The <SonarQubeTargetsImported>true</SonarQubeTargetsImported> setting is expected to be in the file .sonarqube/bin/targets/SonarQube.Integration.targets.

Try setting it in your database .csproj, or (better) passing it as an additional MSBuild command line argument to the database build step i.e /p:SonarQube.Integration.targets=true