Tuesday, September 6, 2011

Tip for making AutoFixture and xUnit.net play nice

Just a quick tip, for making AutoFixture 2.1 play nice with newer xUnit.net versions:

I installed Autofixture via NuGet, which gave me AutoFixture 2.1 and xUnit 1.7, when running my tests they threw this:

   Could not load file or assembly 
   'Ploeh.AutoFixture, Version=, Culture=neutral,
   or one of its dependencies. 
The system cannot find the file specified.

The reason is that the test runner thinks that AutoFixture needs and older version of xUnit (although it doesn't really).
The solution is to put this in the app.config for the test projects:

    1   <runtime>
    2     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    3       <dependentAssembly>
    4         <assemblyIdentity name="xunit.extensions"
    5                           publicKeyToken="8d05b1bb7a6fdb6c"
    6                           culture="neutral"/>
    7         <bindingRedirect oldVersion=""
    8                          newVersion=""/>
    9       </dependentAssembly>
   10     </assemblyBinding>
   11   </runtime>

You'll probably have to fix up the newVersion to the exact version you have.

That's it for now.

No comments:

Post a Comment