加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

.net – 在XUnit中使用Moles – 错误的dll版本

发布时间:2020-12-14 01:55:11 所属栏目:Windows 来源:网络整理
导读:我正在尝试设置Moles以用于我们的单元测试.我们正在使用xunit,所以我使用的是带有moles的Xunit扩展(Microsoft.Moles.Framework.Xunit).但是,当我们运行Xunit 1.7时,Moles抱怨我没有运行版本1.6.1.1521(带有FileLoadException). Moles Manual(第28页)确实说:
我正在尝试设置Moles以用于我们的单元测试.我们正在使用xunit,所以我使用的是带有moles的Xunit扩展(Microsoft.Moles.Framework.Xunit).但是,当我们运行Xunit 1.7时,Moles抱怨我没有运行版本1.6.1.1521(带有FileLoadException).

Moles Manual(第28页)确实说:

xUnit.net Version:

1.5.0.1479 (for other xUnit.net versions,recompile the attribute from sources)

这就是我被卡住的地方 – 这个xunit扩展的源代码是在哪里可用的?或者我是否必须使用Moles要求的特定版本的xunit?

解决方法

你不能在moles.runner.exe.config中定义程序集绑定重定向吗?

<configuration>
    <runtime>
        <assemblyBinding  xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity
                    name="xunit.dll"
                    publicKeyToken="8d05b1bb7a6fdb6c" />
                <bindingRedirect oldVersion="1.5.0.1479" newVersion="1.6.1.1521" />
            </dependentAssembly>
        </assemblyBinding>
    </runtime>
</configuration>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读