Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Teamcity 重定向AutoFixture的Moq参考_Teamcity_Moq_Autofixture_Automoq - Fatal编程技术网

Teamcity 重定向AutoFixture的Moq参考

Teamcity 重定向AutoFixture的Moq参考,teamcity,moq,autofixture,automoq,Teamcity,Moq,Autofixture,Automoq,我在构建服务器上的单个测试项目中遇到一些问题。项目中的一些测试使用AutoFixture和AutoMoq 由于AutoMoq使用的Moq版本比我们使用的版本旧,因此我们在app.config中有一个重定向(我假设是由AutoMoq NuGet脚本生成的): 为什么对(4.0.10827.0)的最低起订量参考没有重定向到4.2.1409.1722 我已经检查了build server工作目录,app.config和DLL看起来很好。如AutoFixture中所述,它不会也不会依赖于最新版本 您的错

我在构建服务器上的单个测试项目中遇到一些问题。项目中的一些测试使用AutoFixture和AutoMoq

由于AutoMoq使用的Moq版本比我们使用的版本旧,因此我们在app.config中有一个重定向(我假设是由AutoMoq NuGet脚本生成的):

为什么对(4.0.10827.0)的最低起订量参考没有重定向到4.2.1409.1722

我已经检查了build server工作目录,app.config和DLL看起来很好。

如AutoFixture中所述,它不会也不会依赖于最新版本


您的错误消息与任何AutoFixture本身要求的任何版本无关,因此您的环境中的某些内容是唯一可能的解释。我正在使用
\\live.sysinternals.com\tools\procexp.exe
查看从何而来。

我不知道这是否会有帮助,但我有一个类似症状的问题,解决方案完全是另一个问题,即:

FWIW,让人想起这个问题:很难判断是否是同一个问题,由于报告没有提供详细信息。在生成服务器运行的单元测试上使用procexp(这是一个仅限于生成服务器的问题)可能会很困难。我最终在没有AutoFixture的情况下重写了测试。所有其他使用AutoFixture和Moq的测试项目都可以正常工作。我的观点是,Moq
4.2.1409.1722
req肯定不是来自AF,因此您需要找出环境中引入冲突的原因。这不像是一个杂散电子或是自动夹具中的什么东西造成的。当你从根本上解决它的时候,这将是一件非常无聊的事情。虽然在没有依赖项的情况下重写总是有它的优点,但是引起根源的东西以及找出你和/或你的构建脚本做错了什么也有它的优点。
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Moq" publicKeyToken="69f491c39445e920" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.2.1409.1722" newVersion="4.2.1409.1722" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Ploeh.AutoFixture" publicKeyToken="b24654c590009d4f" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.20.2.0" newVersion="3.20.2.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
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)