加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – 使用xUnit处理netstandard1.6

发布时间:2020-12-15 08:22:24 所属栏目:百科 来源:网络整理
导读:我希望使用netstandard1.6库的测试框架.我试图关注并编辑 Getting started with xUnit.net (.NET Core / ASP.NET Core)但没有成功.使用我的project.json文件在VS 2015 Update 3 RTM上使用带有dotnetcore lib的xUnit教程重现错误. project.json: { "version"
我希望使用netstandard1.6库的测试框架.我试图关注并编辑 Getting started with xUnit.net (.NET Core / ASP.NET Core)但没有成功.使用我的project.json文件在VS 2015 Update 3 RTM上使用带有dotnetcore lib的xUnit教程重现错误.

project.json:

{
  "version": "1.0.0-*","testRunner": "xunit","dependencies": {
    "NETStandard.Library": "1.6.0","xunit": "2.2.0-beta2-build3300","dotnet-test-xunit": "2.2.0-preview2-build1029"
  },"frameworks": {
    "netstandard1.6": {
      "imports": "dnxcore50"
    }
  },"runtimes": {
    "win10-arm": {},"win10-arm-aot": {},"win10-x86": {},"win10-x86-aot": {},"win10-x64": {},"win10-x64-aot": {}
  }
}

错误:

Severity    Code    Description
Error       NU1002  The dependency dotnet-test-xunit 2.2.0-preview2-build1029 does not support framework .NETStandard,Version=v1.0

我可以降级到dotnet-test-xunit 2.2.0-preview2-build1029支持的.netstandard版本吗?有没有任何已知的工作来使用xUnit?

由于我是一个新的project.json和dotnetcore,我可能会错过一些有用的东西.

解决方法

这对我有用.现有的xunit版本似乎还不支持netstandard 1.6库.尝试将项目json更改为 xunit site中提供的内容.这也假设您创建了一个.net核心库项目
{
  "version": "1.0.0-*","dependencies": {
    "xunit": "2.2.0-beta2-build3300","frameworks": {
    "netcoreapp1.0": {
       "dependencies": {
          "Microsoft.NETCore.App": {
             "type": "platform","version": "1.0.0"
           }
         }
      }
   }
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读