Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TFS 2010 build failing because it can't load Microsoft.VisualStudio.QualityTools.Plugins.CodeCoverage version 11.0

Tags:

tfs

tfsbuild

My TFS 2010 builds are failing inexplicably. The unit tests are passing, there are no warnings or errors. The build runs completely, beginning to end, but is partially succeeding. It took a while for me to find any error at all--I had to download the test results and then click a link at the top labelled "Test run error". The error is:

Error   01/14/2013 1:31:47 AM   The diagnostic data adapter 'Microsoft.VisualStudio.TestTools.CodeCoverage.CoveragePlugIn, Microsoft.VisualStudio.QualityTools.Plugins.CodeCoverage, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' on agent 'BuildServer3' threw an exception during type loading, construction, or initialization: System.IO.FileLoadException: Could not load file or assembly 'Microsoft.VisualStudio.QualityTools.Plugins.CodeCoverage, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'Microsoft.VisualStudio.QualityTools.Plugins.CodeCoverage, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
   at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, Boolean loadTypeFromPartialName, ObjectHandleOnStack type)
   at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, Boolean loadTypeFromPartialName)
   at System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
   at System.Type.GetType(String typeName, Boolean throwOnError)
   at Microsoft.VisualStudio.TestTools.DataCollection.ExecutionPluginManager.LoadAndInitDataCollectorAsync(TestRun testRun, String collectorTypeName, Dictionary`2 dataCollectorCache)

This is from a Visual Studio 2012 solution, the build server runs Visual Studio 2010...so I'm guessing that's why it's failing.

like image 300
Paul Oliver Avatar asked Jan 16 '13 00:01

Paul Oliver


1 Answers

I figured out the problem.

I had created a CodeCoverage.testsettings file to measure Code Coverage during the builds...but I created the file in Visual Studio 2012. I found this entry in the file using my favorite text editor:

<DataCollector uri="datacollector://microsoft/CodeCoverage/1.0" assemblyQualifiedName="Microsoft.VisualStudio.TestTools.CodeCoverage.CoveragePlugIn, Microsoft.VisualStudio.QualityTools.Plugins.CodeCoverage, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" friendlyName="Code Coverage (Visual Studio 2010)">

I saw a Version of 11.0.0.0 in there (which must have been generated by Visual Studio 2012). I just changed it to 10.0.0.0 using my text editor:

<DataCollector uri="datacollector://microsoft/CodeCoverage/1.0" assemblyQualifiedName="Microsoft.VisualStudio.TestTools.CodeCoverage.CoveragePlugIn, Microsoft.VisualStudio.QualityTools.Plugins.CodeCoverage, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" friendlyName="Code Coverage (Visual Studio 2010)">

The build now works as expected.

like image 79
Paul Oliver Avatar answered Oct 21 '22 11:10

Paul Oliver