gpt4 book ai didi

.net-4.0 - xUnit 1.9.2 和 .Net 4.0

转载 作者:行者123 更新时间:2023-12-04 23:22:06 24 4
gpt4 key购买 nike

我正在尝试为 C# 测试实现 xUnit,但遇到了一个奇怪的错误。

我可以在 VisualStudio (2013) 中运行单元测试,但是当我尝试使用 GUI 或控制台运行相同的测试时,出现错误:

xUnit.net console test runner (32-bit .NET 2.0.50727.5472)
Copyright (C) 2013 Outercurve Foundation.

Could not load file or assembly '[...]' or one of its dependencies.
This assembly is built by a runtime newer than the currently loaded
runtime and cannot be loaded.

我的项目使用 .net 4.0,看起来 xUnit 使用 2.0。

我找到了几个帖子 herehere ,其中包括说您可以编辑配置文件,但这对我不起作用。这两个帖子都有几年的历史了,他们甚至不同意对方。一个说条目应该是'supportedRuntime',而另一个是'requiredRuntime'。然而,它们都不适合我。

我还考虑过下载源代码并使用 4.0 进行编译,但根据网站,它需要 VS 2010。

在 IDE 中运行测试很棒,但我还需要使用控制台运行器来在我们的构建机器上实现自动化测试。有没有办法让它发挥作用?还是不再维护 xUnit?

我还找到了 another post问题应该在 2010 年得到解决。也许这是回归失败?

最佳答案

谢谢,马克。但我后来发现 .net 4.0 有一个单独的 xunit.console.clr4.exe 可执行文件。

也许我在这上面浪费了 1/2 天后很痛苦,但 xUnit 网站上没有提到这一点。事实上,该站点只讨论使用 VS 运行测试。我在博客网站上找到了对控制台运行程序的引用。

开始怀疑 xUnit,也许我应该看看 nUnit。它似乎至少有文档。

关于.net-4.0 - xUnit 1.9.2 和 .Net 4.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21442312/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com