I recently build a tool that automates and simplifies the unit testing of large parts of our application's business layer. The system works by declaratively specifying scenarios in xml files which are read by using the MS test's data driven test cases and validated against a set of "business rules". The tool is tailored to our company internal development model and dramatically increases the speed with which the BL layer can be tested.I integrated the unit testing facility in our class library which required me to include the Microsoft.VisualStudio.QualityTools.UnitTestFramework as I needed some of its functionalities. Now since our class library was developed when using VS2008, the referenced version of the UnitTestFramework was 22.214.171.124. It worked fine so far until recently one of my work mates was calling me due to a problem with the tool. While for others everything worked perfectly, he got the following exception when launching the tests:
Test method Company.Project.BusinessLogic.UnitTests.ValueBLUnitTest.TestValidateValueBLRules threw exception:The problem was basically that he didn't have VS2008 installed on his machine. Hence, the v126.96.36.199 of the UnitTestFramework.dll wasn't present, but just the VS2010 v10.0.0.0.
Could not load file or assembly 'Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=188.8.131.52, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
The system cannot find the file specified.WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
Exchanging the used dll with the latest v10 is not an option since there are still some devs which do not yet have VS2010 installed (yes...), mainly because many "older" projects they need to maintain are still running .Net 3.5 and have a VS2008 solution. So for the mean time, the simplest solution is to perform an assembly (re)binding on the unit test projects, either by down or up-"grading" the version to the correct and present dll on the target system which can be done as follows:
<?xml version="1.0" encoding="utf-8" ?>While this is certainly not an optimal solution it does the job for now.
<assemblyIdentity name="Microsoft.VisualStudio.QualityTools.UnitTestFramework" publicKeyToken="b03f5f7f11d50a3a"/>
<bindingRedirect oldVersion="184.108.40.206" newVersion="10.0.0.0"/>