Originally posted on http://geekswithblogs.net/Aligned/archive/2014/01/10/microsoft.visualstudio.testtools-versioning-problems.aspx
The Problem
Our project was created in Visual Studio 2012 and now we have moved to 2013. The gated check in build kept giving me version errors, even though it built and ran fine locally and I had referenced version 12 (from version 11).
I tried editing the XML of the project, adding hintpaths, setting the set local to true and setting specific version, but kept getting this error.
Assembly ‘X.UITestFramework, Version=1.0.5122.28413, Culture=neutral, PublicKeyToken=null' uses 'Microsoft.VisualStudio.TestTools.UITesting, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
which has a higher version than referenced assembly 'Microsoft.VisualStudio.TestTools.UITesting, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
I have 2 projects UITestFramework
which has helper methods for our Selenium UI tests which is a C# class project and UIAutomation
which is a Coded UI test project with the test method.
The Coded UI test has a few interesting lines that the class project does not:
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">
$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\
$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>True</IsCodedUITest>
and at the bottom:
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets"
Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
The Fix
Notice the Version is set to 10.0. I should have changed that number to 12.0. That would be one way to fix it. However, I chose to remove these lines from the project XML and add the DLLs manually from add reference from the C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PublicAssemblies\ folder.