Publish Quality Gate Result task failure

Was working since March, started failing last night. Reinstalled the plug in and restarted the SQ server and TFS server.
Failing in Build task for MSBuild in TFS 2018 (C#)
SonarQube 7.6
SonarScanner 4.8

2019-09-19T17:51:52.3181119Z ##[section]Starting: Prepare analysis on SonarQube
2019-09-19T17:51:52.3397905Z ==============================================================================
2019-09-19T17:51:52.3398236Z Task         : Prepare Analysis Configuration
2019-09-19T17:51:52.3398481Z Description  : Prepare SonarQube analysis configuration
2019-09-19T17:51:52.3398722Z Version      : 4.8.0
2019-09-19T17:51:52.3398934Z Author       : sonarsource
2019-09-19T17:51:52.3399190Z Help         : [More Information](http://redirect.sonarsource.com/doc/install-configure-scanner-tfs-ts.html)
2019-09-19T17:51:52.3399490Z ==============================================================================
2019-09-19T17:51:53.2467101Z [command]E:\TfsData\_work\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.8.0\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe begin /k:xxxxxxx
2019-09-19T17:51:53.3358196Z SonarScanner for MSBuild 4.7.1
2019-09-19T17:51:53.3361862Z Using the .NET Framework version of the Scanner for MSBuild
2019-09-19T17:51:53.3906980Z Pre-processing started.
2019-09-19T17:51:53.3921190Z Preparing working directories...
2019-09-19T17:51:53.4810192Z 10:51:53.473  Updating build integration targets...
2019-09-19T17:51:53.5025271Z 10:51:53.488  Fetching analysis configuration settings...
2019-09-19T17:51:53.8641226Z 10:51:53.848  Provisioning analyzer assemblies for cs...
2019-09-19T17:51:53.8652814Z 10:51:53.863  Installing required Roslyn analyzers...
2019-09-19T17:51:54.1494022Z 10:51:54.145  Provisioning analyzer assemblies for vbnet...
2019-09-19T17:51:54.1494726Z 10:51:54.145  Installing required Roslyn analyzers...
2019-09-19T17:51:54.1912464Z 10:51:54.176  Pre-processing succeeded.
2019-09-19T17:51:54.2082937Z ##[section]Finishing: Prepare analysis on SonarQube

2019-09-19T17:52:12.4036107Z ##[section]Starting: Run Code Analysis
2019-09-19T17:52:12.4038890Z ==============================================================================
2019-09-19T17:52:12.4039180Z Task         : Run Code Analysis
2019-09-19T17:52:12.4039463Z Description  : Run scanner and upload the results to the SonarQube server.
2019-09-19T17:52:12.4039721Z Version      : 4.8.0
2019-09-19T17:52:12.4039962Z Author       : sonarsource
2019-09-19T17:52:12.4040319Z Help         : This task is not needed for Maven and Gradle projects since the scanner should be run as part of the build.

[More Information](http://redirect.sonarsource.com/doc/install-configure-scanner-tfs-ts.html)
2019-09-19T17:52:12.4040721Z ==============================================================================
2019-09-19T17:52:12.7141881Z [command]E:\TfsData\_work\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.8.0\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe end
2019-09-19T17:52:12.8029920Z SonarScanner for MSBuild 4.7.1
2019-09-19T17:52:12.8128166Z Using the .NET Framework version of the Scanner for MSBuild
2019-09-19T17:52:12.8577085Z Post-processing started.
2019-09-19T17:52:13.0092521Z 10:52:13.006  10:52:13.006  WARNING: Failed to find the code coverage command line tool. Possible cause: Visual Studio is not installed, or the installed version does not support code coverage.
2019-09-19T17:52:13.1393820Z Calling the SonarQube Scanner...
2019-09-19T17:52:13.3925535Z INFO: Scanner configuration file: E:\TfsData\_work\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.8.0\classic-sonar-scanner-msbuild\sonar-scanner-4.1.0.1829\bin\..\conf\sonar-scanner.properties
2019-09-19T17:52:13.3929472Z INFO: Project root configuration file: E:\TfsData\_work\289\.sonarqube\out\sonar-project.properties
2019-09-19T17:52:13.4211915Z INFO: SonarQube Scanner 4.1.0.1829
2019-09-19T17:52:13.4212346Z INFO: Java 1.8.0_202 Oracle Corporation (64-bit)
2019-09-19T17:52:13.4212614Z INFO: Windows Server 2012 R2 6.3 amd64
2019-09-19T17:52:13.8058254Z INFO: User cache: C:\Users\operator\.sonar\cache
2019-09-19T17:52:13.8966116Z INFO: SonarQube server 7.6.0
2019-09-19T17:52:13.8969231Z INFO: Default locale: "en_US", source code encoding: "windows-1252" (analysis is platform dependent)
2019-09-19T17:52:14.3077667Z INFO: Load global settings
2019-09-19T17:52:14.4064616Z INFO: Load global settings (done) | time=94ms
2019-09-19T17:52:14.4138859Z INFO: Server id: E4A3DB3D-AWngSOs4KyvjNOmrcWVf
2019-09-19T17:52:14.4315242Z INFO: User cache: C:\Users\operator\.sonar\cache
2019-09-19T17:52:14.6555360Z INFO: Load/download plugins
2019-09-19T17:52:14.6556993Z INFO: Load plugins index
2019-09-19T17:52:14.7181106Z INFO: Load plugins index (done) | time=62ms
2019-09-19T17:52:14.7470719Z INFO: Load/download plugins (done) | time=94ms
2019-09-19T17:52:15.3966232Z INFO: Process project properties
2019-09-19T17:52:15.4067103Z INFO: Execute project builders
2019-09-19T17:52:15.4146047Z INFO: Execute project builders (done) | time=0ms
2019-09-19T17:52:15.4177064Z WARN: Failed to set working directory hidden: E:\TfsData\_work\289\.sonarqube\out\.sonar
2019-09-19T17:52:15.4177471Z INFO: Project key: xxxxxxxx
2019-09-19T17:52:15.4180426Z INFO: Base dir: E:\TfsData\_work\289\s
2019-09-19T17:52:15.4181053Z INFO: Working dir: E:\TfsData\_work\289\.sonarqube\out\.sonar
2019-09-19T17:52:15.4207224Z WARN: Failed to set working directory hidden: E:\TfsData\_work\289\.sonarqube\out\.sonar\mod0
2019-09-19T17:52:15.4479298Z INFO: Load project settings
2019-09-19T17:52:15.4973516Z INFO: Load project settings (done) | time=63ms
2019-09-19T17:52:15.6021918Z INFO: Load project repositories
2019-09-19T17:52:15.6862877Z INFO: Load project repositories (done) | time=94ms
2019-09-19T17:52:15.6870732Z INFO: Load quality profiles
2019-09-19T17:52:15.7611499Z INFO: Load quality profiles (done) | time=78ms
2019-09-19T17:52:15.7896831Z INFO: Load active rules
2019-09-19T17:52:16.6186841Z INFO: Load active rules (done) | time=828ms
2019-09-19T17:52:16.6194433Z INFO: Load metrics repository
2019-09-19T17:52:16.6513412Z INFO: Load metrics repository (done) | time=31ms
2019-09-19T17:52:16.7265979Z INFO: Indexing files...
2019-09-19T17:52:16.7268787Z INFO: Project configuration:
2019-09-19T17:52:16.7294876Z INFO: Indexing files of module 'xxxxxxx'
2019-09-19T17:52:16.7300910Z INFO:   Base dir: E:\TfsData\_work\289\s
2019-09-19T17:52:16.7310985Z INFO:   Source paths: Default.aspx.cs, Default.aspx.designer.cs, Properties/Assembl...
2019-09-19T17:52:16.7496479Z INFO: Indexing files of module 'xxxxxxx'
2019-09-19T17:52:16.7499501Z INFO:   Base dir: E:\TfsData\_work\289\s
2019-09-19T17:52:16.7501120Z INFO: 11 files indexed
2019-09-19T17:52:16.7514104Z INFO: Quality profile for cs: Sonar way
2019-09-19T17:52:16.7515204Z INFO: Quality profile for web: Sonar way
2019-09-19T17:52:16.7515723Z INFO: ------------- Run sensors on module xxxxxxx
2019-09-19T17:52:18.2610310Z INFO: Sensor JaCoCo XML Report Importer [jacoco]
2019-09-19T17:52:18.2641353Z INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=15ms
2019-09-19T17:52:18.2671260Z INFO: Sensor C# Properties [csharp]
2019-09-19T17:52:18.2674829Z WARN: Analyzer working directory does not exist: 'E:\TfsData\_work\289\.sonarqube\out\0\output-cs'. Analyzer results won't be loaded from this directory.
2019-09-19T17:52:18.2676570Z INFO: Sensor C# Properties [csharp] (done) | time=0ms
2019-09-19T17:52:18.2678838Z INFO: Sensor JavaXmlSensor [java]
2019-09-19T17:52:18.2705285Z INFO: Sensor JavaXmlSensor [java] (done) | time=0ms
2019-09-19T17:52:18.2707066Z INFO: Sensor HTML [web]
2019-09-19T17:52:18.5153079Z INFO: Sensor HTML [web] (done) | time=250ms
2019-09-19T17:52:18.5158895Z INFO: ------------- Run sensors on module xxxxxxx
2019-09-19T17:52:18.5823662Z INFO: Sensor JaCoCo XML Report Importer [jacoco]
2019-09-19T17:52:18.5829374Z INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=0ms
2019-09-19T17:52:18.5832370Z INFO: Sensor JavaXmlSensor [java]
2019-09-19T17:52:18.5833230Z INFO: Sensor JavaXmlSensor [java] (done) | time=0ms
2019-09-19T17:52:18.5833650Z INFO: Sensor C# [csharp]
2019-09-19T17:52:18.5925490Z INFO: Importing 1 Roslyn report
2019-09-19T17:52:18.6531322Z WARN: Rule CS0168 was not found in the SARIF report, assuming default severity
2019-09-19T17:52:18.6571294Z WARN: Rule CS0168 was not found in the SARIF report, assuming default severity
2019-09-19T17:52:18.6573679Z INFO: Sensor C# [csharp] (done) | time=78ms
2019-09-19T17:52:18.6574401Z INFO: Sensor Zero Coverage Sensor
2019-09-19T17:52:18.6690500Z INFO: Sensor Zero Coverage Sensor (done) | time=16ms
2019-09-19T17:52:18.6693226Z INFO: ------------- Run sensors on project
2019-09-19T17:52:18.6859509Z INFO: SCM provider for this project is: tfvc
2019-09-19T17:52:18.6865879Z INFO: 4 files to be analyzed
2019-09-19T17:52:19.8906928Z INFO: 0/4 files analyzed
2019-09-19T17:52:19.8907852Z WARN: Missing blame information for the following files:
2019-09-19T17:52:19.8908256Z WARN:   * Default.aspx.cs
2019-09-19T17:52:19.8908535Z WARN:   * Default.aspx.designer.cs
2019-09-19T17:52:19.8908828Z WARN:   * Properties/AssemblyInfo.cs
2019-09-19T17:52:19.8910202Z ##[error]ERROR: SCM-TFVC: missing initial output from annotator.
2019-09-19T17:52:19.8911000Z ERROR: SCM-TFVC: missing initial output from annotator.
2019-09-19T17:52:19.8911257Z WARN:   * Default.aspx
2019-09-19T17:52:19.8911562Z WARN: This may lead to missing/broken features in SonarQube
2019-09-19T17:52:19.8912674Z ##[error]ERROR: SCM-TFVC: 
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.TeamFoundation.Client, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
  at SonarSource.TfsAnnotate.Program.Main(String[] args)
2019-09-19T17:52:19.8913464Z ERROR: SCM-TFVC: 
2019-09-19T17:52:19.8914155Z Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.TeamFoundation.Client, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
2019-09-19T17:52:19.8915373Z    at SonarSource.TfsAnnotate.Program.Main(String[] args)
2019-09-19T17:52:19.8915547Z 
2019-09-19T17:52:19.8978833Z INFO: Calculating CPD for 1 file
2019-09-19T17:52:19.9171867Z INFO: CPD calculation finished
2019-09-19T17:52:20.0076153Z INFO: Analysis report generated in 94ms, dir size=147 KB
2019-09-19T17:52:20.0231099Z INFO: Analysis report compressed in 15ms, zip size=26 KB
2019-09-19T17:52:20.0806344Z INFO: Analysis report uploaded in 63ms
2019-09-19T17:52:20.0817421Z INFO: ANALYSIS SUCCESSFUL, you can browse http://000.000.0.0:9000/dashboard?id=xxxxxxx
2019-09-19T17:52:20.0817974Z INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
2019-09-19T17:52:20.0818433Z INFO: More about the report processing at http://000.000.0.0:9000/api/ce/task?id=AW1Kp0hTBgQ_dEtpUWGm
2019-09-19T17:52:20.0937062Z INFO: Analysis total time: 5.270 s
2019-09-19T17:52:20.1505455Z INFO: ------------------------------------------------------------------------
2019-09-19T17:52:20.1505915Z INFO: EXECUTION SUCCESS
2019-09-19T17:52:20.1506355Z INFO: ------------------------------------------------------------------------
2019-09-19T17:52:20.1506696Z INFO: Total time: 6.773s
2019-09-19T17:52:20.2223117Z INFO: Final Memory: 16M/284M
2019-09-19T17:52:20.2224087Z INFO: ------------------------------------------------------------------------
2019-09-19T17:52:20.2665429Z The SonarQube Scanner has finished
2019-09-19T17:52:20.2720032Z 10:52:20.263  Post-processing succeeded.
2019-09-19T17:52:20.2867392Z ##[section]Finishing: Run Code Analysis

2019-09-19T17:52:20.2885130Z ##[section]Starting: Publish Quality Gate Result
2019-09-19T17:52:20.2888534Z ==============================================================================
2019-09-19T17:52:20.2888834Z Task         : Publish Quality Gate Result
2019-09-19T17:52:20.2889188Z Description  : Publish SonarQube's Quality Gate result on the Azure DevOps build result, to be used after the actual analysis.
2019-09-19T17:52:20.2889476Z Version      : 4.8.0
2019-09-19T17:52:20.2889742Z Author       : sonarsource
2019-09-19T17:52:20.2890100Z Help         : [More Information](http://redirect.sonarsource.com/doc/install-configure-scanner-tfs-ts.html)
2019-09-19T17:52:20.2890462Z ==============================================================================
2019-09-19T17:52:23.3156857Z SYSTEMVSSCONNECTION exists true
2019-09-19T17:52:23.3160750Z SYSTEMVSSCONNECTION exists true
2019-09-19T17:52:23.3551345Z ##[error]unable to verify the first certificate
2019-09-19T17:52:23.3639328Z ##[section]Finishing: Publish Quality Gate Result

Hi @mmantel

Given the logs, it seems that you are using the SCM-TFVC community plugin, which apparently requires the missing DLL.

You can install it (maybe again) from here
: https://marketplace.visualstudio.com/items?itemName=ErinDormierMSFT.TeamFoundationServer2013Update4ObjectModelInstalle

Could you please let us know if it’s working again ?

Thank you.

Mickaël

Sorry, just saw this. Will reinstall it and let you know. Thx.

Hi, Mickael. Please, where the missing dll must be installed? in the TFS agent server or in the SonarQube server??
Thanks!
Jorge E. Ulloa

On the TFS agent i would say

Hosting was unwilling to install the older version of OMI as we are on a newer version. But the Build is not failing now, just getting a bunch of warning and a couple of errors. I am not sure what changed as it was failing. Here are the logs:

CSC(0,0): Warning CS8032: An instance of analyzer SonarAnalyzer.Rules.CSharp.ThreadStaticWithInitializer cannot be created from C:\Users\operator\AppData\Local\Temp.sonarqube\resources\0\SonarAnalyzer.CSharp.dll : Could not load file or assembly ‘Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified…

CSC (0, 0)

CSC(0,0): Warning CS8032: An instance of analyzer SonarAnalyzer.Rules.CSharp.MutableFieldsShouldNotBePublicReadonly cannot be created from C:\Users\operator\AppData\Local\Temp.sonarqube\resources\0\SonarAnalyzer.CSharp.dll : Could not load file or assembly ‘Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified…

CSC (0, 0)

CSC(0,0): Warning CS8032: An instance of analyzer SonarAnalyzer.Rules.CSharp.GetHashCodeEqualsOverride cannot be created from C:\Users\operator\AppData\Local\Temp.sonarqube\resources\0\SonarAnalyzer.CSharp.dll : Could not load file or assembly ‘Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified…

CSC (0, 0)

CSC(0,0): Warning CS8032: An instance of analyzer SonarAnalyzer.Rules.CSharp.CallToAsyncMethodShouldNotBeBlocking cannot be created from C:\Users\operator\AppData\Local\Temp.sonarqube\resources\0\SonarAnalyzer.CSharp.dll : Could not load file or assembly ‘Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified…

CSC (0, 0)

CSC(0,0): Warning CS8032: An instance of analyzer SonarAnalyzer.Rules.CSharp.FrameworkTypeNaming cannot be created from C:\Users\operator\AppData\Local\Temp.sonarqube\resources\0\SonarAnalyzer.CSharp.dll : Could not load file or assembly ‘Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified…

CSC (0, 0)

CSC(0,0): Warning CS8032: An instance of analyzer SonarAnalyzer.Rules.CSharp.RedundantArgument cannot be created from C:\Users\operator\AppData\Local\Temp.sonarqube\resources\0\SonarAnalyzer.CSharp.dll : Could not load file or assembly ‘Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified…

CSC (0, 0)

CSC(0,0): Warning CS8032: An instance of analyzer SonarAnalyzer.Rules.CSharp.OptionalParameterNotPassedToBaseCall cannot be created from C:\Users\operator\AppData\Local\Temp.sonarqube\resources\0\SonarAnalyzer.CSharp.dll : Could not load file or assembly ‘Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified…

CSC (0, 0)

CSC(0,0): Warning CS8032: An instance of analyzer SonarAnalyzer.Rules.CSharp.SetLocaleForDataTypes cannot be created from C:\Users\operator\AppData\Local\Temp.sonarqube\resources\0\SonarAnalyzer.CSharp.dll : Could not load file or assembly ‘Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified…

CSC (0, 0)

CSC(0,0): Warning CS8032: An instance of analyzer SonarAnalyzer.Rules.CSharp.ConditionalsWithSameCondition cannot be created from C:\Users\operator\AppData\Local\Temp.sonarqube\resources\0\SonarAnalyzer.CSharp.dll : Could not load file or assembly ‘Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified…

CSC (0, 0)

CSC(0,0): Warning CS8032: An instance of analyzer SonarAnalyzer.Rules.CSharp.UseShortCircuitingOperator cannot be created from C:\Users\operator\AppData\Local\Temp.sonarqube\resources\0\SonarAnalyzer.CSharp.dll : Could not load file or assembly ‘Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified…

CSC (0, 0)

CSC(0,0): Warning CS8032: An instance of analyzer SonarAnalyzer.Rules.CSharp.MethodsShouldNotHaveTooManyLines cannot be created from C:\Users\operator\AppData\Local\Temp.sonarqube\resources\0\SonarAnalyzer.CSharp.dll : Could not load file or assembly ‘Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified…

ERROR: SCM-TFVC: missing initial output from annotator.

ERROR: SCM-TFVC:

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly ‘Microsoft.TeamFoundation.Client, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The system cannot find the file specified.

at SonarSource.TfsAnnotate.Program.Main(String args)

Failed to create a build property. Not blocking unless you are using the Sonar Pre-Deployment gate in Release Pipelines. Exception : Error: unable to verify the first certificate

Check the version of MSBuild that is being used on the build agent. Microsoft.CodeAnalysis.dll ships with MSBuild, and this message normally means that the version of MSBuild is too old. Version v14.0.25420.1 or later is required.

Team Foundation object model: the OM is a client-side wrapper that makes it easier for client-side applications to call the TFS web APIs. If I remember correctly, the newer versions of the TFS still support the web APIs from older version so the OM for TFS2013 will work against a newer version of TFS.

Installing it on the build agent won’t do any harm to other applications, and the SCM-Tfvc plugin won’t work without it (and in fact, I think that the Scanner for MSBuild requires the same OM to correctly process code coverage reports for TFS).