问题
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).
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.
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.
The project is available on GitHub.
The error from the xunit.runner.dnx package:
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!
回答1:
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
.
来源:https://stackoverflow.com/questions/32619892/how-to-run-xunit-tests-in-the-project-json-and-dotnet-tfm-world