dotnet cli 项目上的 xunit
xunit on dotnet cli project
我正在尝试在 dotnet cli 项目上设置 xunit 测试。我意识到这是非常早期的支持阶段。现在,我无法恢复包。下面是我的project.json
{
"version": "1.0.0-*",
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0-rc2-3002392"
},
"xunit": "2.1.0-*",
"dotnet-test-xunit": "1.0.0-dev-*"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"portable-net45+wp80+win8+wpa81+dnxcore50"
]
}
},
"testRunner": "dotnet-test-xunit"
}
在 运行 dotnet restore
之后我得到以下错误:
Package xunit.assert 2.1.0 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package xunit.assert 2.1.0 supports:
- dotnet (.NETPlatform,Version=v5.0)
- portable-net45+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile259)
Package xunit.runner.reporters 2.1.0 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package xunit.runner.reporters 2.1.0 supports:
- dnx451 (DNX,Version=v4.5.1)
- dotnet (.NETPlatform,Version=v5.0)
- net45 (.NETFramework,Version=v4.5)
Package Microsoft.Extensions.Logging.Abstractions 1.0.0-rc2-16040 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.Extensions.Logging.Abstractions 1.0.0-rc2-16040 supports:
- dotnet5.4 (.NETPlatform,Version=v5.4)
- net451 (.NETFramework,Version=v4.5.1)
- netcore50 (.NETCore,Version=v5.0)
Package Microsoft.DiaSymReader 1.0.6 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.DiaSymReader 1.0.6 supports:
- net20 (.NETFramework,Version=v2.0)
- portable-net45+win8 (.NETPortable,Version=v0.0,Profile=Profile7)
Package Microsoft.Extensions.FileSystemGlobbing 1.0.0-rc2-15996 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.Extensions.FileSystemGlobbing 1.0.0-rc2-15996 supports:
- dotnet5.4 (.NETPlatform,Version=v5.4)
- net451 (.NETFramework,Version=v4.5.1)
One or more packages are incompatible with .NETCoreApp,Version=v1.0.
Feeds used:
https://www.myget.org/F/dotnet-core/api/v3/index.json
https://api.nuget.org/v3/index.json
https://www.myget.org/F/coreclr-xunit/api/v2
https://www.myget.org/F/dotnet-cli/
您指定的导入不能满足所有要求。这就是您看到错误的原因。
尝试将它们替换为:
"imports": [
"portable-net451+win8",
"dnxcore50"
]
此外,xunit runner 应该是 "xunit" 而不是 "dotnet-test-xunit"。
我正在尝试在 dotnet cli 项目上设置 xunit 测试。我意识到这是非常早期的支持阶段。现在,我无法恢复包。下面是我的project.json
{
"version": "1.0.0-*",
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0-rc2-3002392"
},
"xunit": "2.1.0-*",
"dotnet-test-xunit": "1.0.0-dev-*"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"portable-net45+wp80+win8+wpa81+dnxcore50"
]
}
},
"testRunner": "dotnet-test-xunit"
}
在 运行 dotnet restore
之后我得到以下错误:
Package xunit.assert 2.1.0 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package xunit.assert 2.1.0 supports:
- dotnet (.NETPlatform,Version=v5.0)
- portable-net45+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile259)
Package xunit.runner.reporters 2.1.0 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package xunit.runner.reporters 2.1.0 supports:
- dnx451 (DNX,Version=v4.5.1)
- dotnet (.NETPlatform,Version=v5.0)
- net45 (.NETFramework,Version=v4.5)
Package Microsoft.Extensions.Logging.Abstractions 1.0.0-rc2-16040 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.Extensions.Logging.Abstractions 1.0.0-rc2-16040 supports:
- dotnet5.4 (.NETPlatform,Version=v5.4)
- net451 (.NETFramework,Version=v4.5.1)
- netcore50 (.NETCore,Version=v5.0)
Package Microsoft.DiaSymReader 1.0.6 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.DiaSymReader 1.0.6 supports:
- net20 (.NETFramework,Version=v2.0)
- portable-net45+win8 (.NETPortable,Version=v0.0,Profile=Profile7)
Package Microsoft.Extensions.FileSystemGlobbing 1.0.0-rc2-15996 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.Extensions.FileSystemGlobbing 1.0.0-rc2-15996 supports:
- dotnet5.4 (.NETPlatform,Version=v5.4)
- net451 (.NETFramework,Version=v4.5.1)
One or more packages are incompatible with .NETCoreApp,Version=v1.0.
Feeds used:
https://www.myget.org/F/dotnet-core/api/v3/index.json
https://api.nuget.org/v3/index.json
https://www.myget.org/F/coreclr-xunit/api/v2
https://www.myget.org/F/dotnet-cli/
您指定的导入不能满足所有要求。这就是您看到错误的原因。
尝试将它们替换为:
"imports": [
"portable-net451+win8",
"dnxcore50"
]
此外,xunit runner 应该是 "xunit" 而不是 "dotnet-test-xunit"。