title: Assembly version conflicts for AutoFixture and Moq with NUnit on TeamCity 7
body: <p>I previously had all unit tests for my solution contained in a single library, and were recently split out. When located in a single assembly, all tests passed both locally and on TeamCity, but when seperated there are version conflicts.</p>
  
  <p><strong>Config:</strong></p>
  
  <ul>
  <li>Team City 7.1.5 (build 24400)</li>
  <li>AutoFixture 3.20.2</li>
  <li>AutoFixture.AutoMoq 3.20.2</li>
  <li>Moq 4.2.1402.2112</li>
  <li>NUnit 2.6.3</li>
  </ul>
  
  <p>I have several unit test assemblies, which all reference a base test library. All test assemblies use the NuGet packages listed above.</p>
  
  <p>When running tests on a dev machine (VS 2015), all tests pass successfully.</p>
  
  <p>When running a team city build, the following error is thrown:</p>
  
  <blockquote>
    <p>System.IO.FileLoadException : Could not load file or assembly 'Moq, Version=4.1.1308.2120, 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)</p>
  </blockquote>
  
  <p>There is no reference to Moq 4.1.1308.2120 anywhere in my solution, so I know it must be a reference from AutoFixture.</p>
  
  <p>Updating AutoFixture to 3.31.3 makes no difference.</p>
  
  <p>I have the following Binding Redirect in the app.config files of all test assemblies:</p>
  
  <pre><code>&lt;dependentAssembly&gt;
    &lt;assemblyIdentity name="Moq" publicKeyToken="69f491c39445e920" culture="neutral" /&gt;
    &lt;bindingRedirect oldVersion="0.0.0.0-4.2.1402.2112" newVersion="4.2.1402.2112" /&gt;
  &lt;/dependentAssembly&gt;
  </code></pre>
  
  <p>I cannot downgrade my version of Moq to 4.1.1308.2120 as I use features of 4.2 in my tests.</p>
  
  <p>It appears to me that Team City is ignoring the redirects. I have no idea why, and having tried every combination of version for these assemblies I cannot get Team City to run the tests successfully.</p>