我用的xUnit測試一個ASP.NET 5和6 MVC項目的工作,但是當我嘗試執行dnx . test
我得到這個錯誤:無法解決dnx中的依賴關係錯誤。測試
dnx : System.InvalidOperationException: Failed to resolve the following dependencies for target framework 'DNX,Version=v4.5.1':
At line:1 char:1
+ dnx . test
+ ~~~~~~~~~~
+ CategoryInfo : NotSpecified: (System.InvalidO...ersion=v4.5.1'::String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
Microsoft.CSharp 4.0.0-beta-23019
System.Collections 4.0.10-beta-23019
System.Linq 4.0.0-beta-23019
System.Runtime 4.0
.10-beta-23019
System.Threading 4.0.10-beta-23019
xunit 2.1.0-beta4
xunit.runner.dnx 2.1.0-beta4
Searched Locations:
D:\Project\{name}\project.json
D:\Project\MrBellhop.Test\src\{name}\project.json
D:\Project\MrBellhop.Test\test\{name}\project.json
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\{name}.dll
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Facades\{name}.dll
C:\Windows\Microsoft.NET\assembly\GAC_32\{name}\{version}\{name}.dll
C:\Windows\Microsoft.NET\assembly\GAC_64\{name}\{version}\{name}.dll
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\{name}\{version}\{name}.dll
Try running 'dnu restore'.
at Microsoft.Framework.Runtime.DefaultHost.GetEntryPoint(String applicationName)
at Microsoft.Framework.ApplicationHost.Program.ExecuteMain(DefaultHost host, String applicationName, String[] args)
at Microsoft.Framework.ApplicationHost.Program.Main(String[] args)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Framework.Runtime.Common.EntryPointExecutor.Execute(Assembly assembly, String[] args, IServiceProvider serviceProvider)
at dnx.host.Bootstrapper.RunAsync(List`1 args, IRuntimeEnvironment env, FrameworkName targetFramework)
at dnx.host.RuntimeBootstrapper.ExecuteAsync(String[] args, FrameworkName targetFramework)
at dnx.host.RuntimeBootstrapper.Execute(String[] args, FrameworkName targetFramework)
> + CategoryInfo : NotSpecified: (System.InvalidO...ersion=v4.5.1'::String) [], RemoteException
> + FullyQualifiedErrorId : NativeCommandError
我按照this manual,雖然我實現了一個簡單的例子我犯了同樣的錯誤。
我project.json
{
"version": "1.0.0-*",
"description": "Project.Test",
"authors": [ "" ],
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",
"dependencies": {
"System.Collections": "4.0.10-beta-23019",
"System.Linq": "4.0.0-beta-23019",
"System.Threading": "4.0.10-beta-23019",
"System.Runtime": "4.0.10-beta-23019",
"Microsoft.CSharp": "4.0.0-beta-23019",
"xunit": "2.1.0-beta4-*",
"xunit.runner.dnx": "2.1.0-beta4-*"
},
"commands": {
"test": "xunit.runner.dnx"
},
"frameworks": {
"dnx451": { },
"dnxcore50": { }
}
}
我使用Asp.net 5測試版6
你知道如何解決這個問題?
您可以分享'project.json'文件和'dnx的整個輸出。在設置DNX_TRACE = 1環境變量之後進行測試? –
您使用的是什麼版本的DNX? [你可以不必再使用speficy的路徑](https://github.com/aspnet/Announcements/issues/52)。例如:嘗試'dnx測試'。 –
dnx測試返回「請指定要運行的命令」 – unairoldan