2015-12-25 59 views
5

尝试在VS2015中测试ASPNET 5应用程序。无法加载应用程序或执行命令'Microsoft.Dnx.TestHost'。可用命令:test

{ 
    "version": "1.0.0-*", 
    "description": "HoldingTank Class Library", 
    "dependencies": { 
    "EntityFramework.InMemory": "7.0.0-rc1-final", 
    "FluentAssertions": "4.1.1", 
    "GenFu": "1.0.4", 
    "MyMVCProject": "1.0.0-*", 
    "xunit": "2.1.0", 
    "xunit.runner.visualstudio": "2.1.0" 
    }, 
    "commands": { 
    "test": "xunit.runner.dnx" 
    }, 
    "frameworks": { 
    "dnx451": { } 
    } 
} 

然而,没有测试在测试浏览器窗口中显示出来,当我按下F5我得到:

------ Discover test started ------ 
------ Test started: Project: HoldingTank ------ 
Starting Microsoft.Dnx.TestHost [C:\Users\erik\.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update1\bin\dnx.exe --appbase "C:\code\PortalSolution\src\HoldingTank" Microsoft.Dnx.ApplicationHost --port 52620 Microsoft.Dnx.TestHost --port 56351 --parentProcessId 8368] 

Error: Unable to load application or execute command 'Microsoft.Dnx.TestHost'. Available commands: test. 
Unable to start Microsoft.Dnx.TestHost 
    ========== Discover test finished: 0 found (0:00:01.8238001) ========== 

我只是有一个测试,饰以[事实],但它不看就像它正在那么远。

看着类似的问题,“无法加载”的错误(但找不到任何特定的TestHost),我试图确保测试项目和应用程序目标相同的框架,但不能' t找到任何差异。我没有看到事件日志中的任何内容。

有什么建议吗? - 甚至不知道该从哪里开始排除故障。

回答

1

您必须添加“xunit.runner.dnx”作为依赖项而不是“xunit.runner.visualstudio”。然后它将在VisualStudio中工作。

由于ASP.Net 5处于测试阶段,因此xunit.runner.dnx也是如此。使用目前与ASP.Net RC1相匹配的预发布...我目前使用2.1.0-rc1-build204与ASP.Net 5 RC1

相关问题