如何在project.json和dotnet tfm世界中运行XUnit测试 [英] How to run XUnit tests in the project.json and dotnet tfm world
问题描述
背景:最近我从旧"世界切换到了新的project.json世界,因为新的总是更好;) 当前,每3个项目中就有2个可以使用"dotnet"目标框架绰号,另一个项目则需要完整的.NET框架(net46).
Background: Recently I switched from the "old" world to the new project.json world, because new is always better ;) Currently 2 out of 3 projects can use the "dotnet" target framework moniker, the other one needs the full .NET framework (net46).
我也将测试项目切换到了新的project.json世界,但是我无法运行任何测试.构建为绿色,但未找到测试.
I also switched my test projects to the new project.json world, but it I can´t run any tests. The build is green, but no tests are found.
我阅读了此文档,其中包括xunit.runner.dnx,但是问题在于这不是一个"dnx"项目-它依赖于"dotnet"或"net46",并且当前运行程序似乎找不到测试.
I read this documentation and included the xunit.runner.dnx, but the problem is that is is not a "dnx" project - it has a dependency on "dotnet" or "net46" and the current runner doesn´t seem to find the tests.
该项目位于 GitHub .
xunit.runner.dnx程序包中的错误:
The error from the xunit.runner.dnx package:
错误项目Sloader.Config.Tests中的依赖项xunit.runner.dnx 2.1.0-beta5-build169不支持框架.NETPlatform,Version = v5.0. Sloader.Config.Tests C:\ Users \ Robert \ Documents \ GitHub \ Sloader \ tests \ Sloader.Config.Tests \ project.json 20 IntelliSense
Error The dependency xunit.runner.dnx 2.1.0-beta5-build169 in project Sloader.Config.Tests does not support framework .NETPlatform,Version=v5.0. Sloader.Config.Tests C:\Users\Robert\Documents\GitHub\Sloader\tests\Sloader.Config.Tests\project.json 20 IntelliSense
当前不支持此功能吗?或者我错过了什么吗?谢谢!
Is this currently not supported or do I miss something? Thanks!
推荐答案
目前无法完成.问题是,与旧的packages.config
系统不同,project.json
的生成系统不会从NuGet软件包中复制引用的DLL.在Microsoft解决此问题之前,您将无法执行此操作.您唯一的办法就是回到packages.config
.
It can't be done right now. The issue is that the build system for project.json
doesn't copy referenced DLLs from NuGet packages, unlike the old packages.config
system. Until Microsoft fixes this behavior, you will not be able to do this. Your only recourse is to go back to packages.config
.
这篇关于如何在project.json和dotnet tfm世界中运行XUnit测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!