VS2015 RTM XUnit测试:无法找到源的运行时安装目录

时间:2015-07-28 15:19:54

标签: visual-studio-2015 asp.net-core xunit dnx

在Visual Studio 2015 RTM中,我们遇到了一个错误,即VS测试资源管理器窗口中未显示任何测试。重建时只收到以下错误:

------ Discover test started ------
Unable to find the runtime installation directory for the source: 'C:\repo\src\Solution\src\Project1.Testing\project.json'
Unable to find the runtime installation directory for the source: 'C:\repo\src\Solution\src\Project2.Testing\project.json'
========== Discover test finished: 0 found (0:00:00.5614723) ==========

Project.json看起来像:

"dependencies": {
    "xunit": "2.1.0-*",
    "xunit.runner.dnx": "2.1.0-*",
    "Microsoft.Framework.Runtime.Abstractions": "1.0.0-beta5"
},
"commands": {
    "test": "xunit.runner.dnx"
},
"frameworks": {
    "dnx451": { } 
}

我们正在使用DNX 1.0.0-beta5。顺便说一句,测试成功找到并在命令行下正常运行(即通过运行" dnx.test")。

2 个答案:

答案 0 :(得分:0)

I've been having this problem for a while but your question made me revisit the errors I was getting and found it was because for my main project I had set the runtime specifically to core framework and my test projects were targeting full framework. Tests worked fine from command line. Just now I updated my test projects to target core framework in project properties to make them the same target as my main project and then after build now my tests do appear in test explorer.

答案 1 :(得分:0)

我自己想通了:

Visual Studio菜单 - >测试 - >测试设置 - >默认处理器架构 - >将它设置为X86解决了我的问题。 (它被意外地设置为X64)。

顺便说一下,(1)如果VS可以提供​​更多信息(例如它寻找的dnx路径),诊断过程可能会容易得多。 (2)在我的解决方案中,global.json中已经存在一个架构属性,想知道为什么VS有另一个全局架构设置会带来冲突。