title: Redirecting Moq reference for AutoFixture
body: <p>I am having some problems with a single test project on our build server. Some of the tests in the project uses AutoFixture with AutoMoq.</p>
  
  <p>Since AutoMoq uses an older Moq version than the one we use otherwise, we have a redirection in the app.config (made by the AutoMoq NuGet script I assume):</p>
  
  <pre><code>  &lt;runtime&gt;
      &lt;assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="Moq" publicKeyToken="69f491c39445e920" culture="neutral" /&gt;
          &lt;bindingRedirect oldVersion="0.0.0.0-4.2.1409.1722" newVersion="4.2.1409.1722" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="Ploeh.AutoFixture" publicKeyToken="b24654c590009d4f" culture="neutral" /&gt;
          &lt;bindingRedirect oldVersion="0.0.0.0-3.20.2.0" newVersion="3.20.2.0" /&gt;
        &lt;/dependentAssembly&gt;
      &lt;/assemblyBinding&gt;
    &lt;/runtime&gt;
  </code></pre>
  
  <p>The tests run without a problem on the developer machines, but one project (among many that uses AutoFixture, AutoMoq and Moq) throws this at me when run with TeamCitys NUnit runner:</p>
  
  <pre><code>Test(s) failed. System.IO.FileLoadException : Could not load file or assembly 'Moq, Version=4.0.10827.0, Culture=neutral, PublicKeyToken=69f491c39445e920' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
     at Ploeh.AutoFixture.AutoMoq.MockPostprocessor.Create(Object request, ISpecimenContext context)
     at Ploeh.AutoFixture.Kernel.CompositeSpecimenBuilder.Create(Object request, ISpecimenContext context)
     at Ploeh.AutoFixture.CustomizationNode.Create(Object request, ISpecimenContext context)
     at Ploeh.AutoFixture.Kernel.CompositeSpecimenBuilder.Create(Object request, ISpecimenContext context)
     at Ploeh.AutoFixture.Kernel.TracingBuilder.Create(Object request, ISpecimenContext context)
     at Ploeh.AutoFixture.Kernel.TerminatingWithPathSpecimenBuilder.Create(Object request, ISpecimenContext context)
     at Ploeh.AutoFixture.BehaviorRoot.Create(Object request, ISpecimenContext context)
     at Ploeh.AutoFixture.Kernel.RecursionGuard.Create(Object request, ISpecimenContext context)
     at Ploeh.AutoFixture.Fixture.Create(Object request, ISpecimenContext context)
     at Ploeh.AutoFixture.Kernel.SpecimenContext.Resolve(Object request)
     at Ploeh.AutoFixture.SpecimenFactory.Create[T](ISpecimenContext context, T seed)
     at Ploeh.AutoFixture.SpecimenFactory.Create[T](ISpecimenContext context)
  </code></pre>
  
  <p>Why is the Moq reference to (4.0.10827.0 apparently) not redirected to 4.2.1409.1722?</p>
  
  <p>I have checked the build-server working directory and the app.config and dlls looks fine.</p>