Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net core 无法在ASP.NET Core RC2中使用版本4.6.1中的程序包_Asp.net Core - Fatal编程技术网

Asp.net core 无法在ASP.NET Core RC2中使用版本4.6.1中的程序包

Asp.net core 无法在ASP.NET Core RC2中使用版本4.6.1中的程序包,asp.net-core,Asp.net Core,我创建了一个ASP.NET核心RC2类库,在project.json上我有: "frameworks": { "net461": { }, "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { "type": "platform", "version": "1.0.0-rc2-3002702" } }, "imports": [

我创建了一个ASP.NET核心RC2类库,在project.json上我有:

"frameworks": {
  "net461": { },
  "netcoreapp1.0": {
    "dependencies": {
      "Microsoft.NETCore.App": {
        "type": "platform",
        "version": "1.0.0-rc2-3002702"
      }
    },
    "imports": [
      "dotnet5.6",
      "dnxcore50",
      "portable-net45+win8"
    ]
  }
}
我在ASP.Net Core RC2 web应用程序上使用了它,project.json具有:

"dependencies": {
  "Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",
  "TestLibrary": "1.0.0",
},

"frameworks": {
  "net461": { }
},
注意:为了简单起见,我省略了其他依赖项

尝试还原Web项目时出现以下错误:

The dependency TestLibrary 1.0.0 does not support framework .NETFramework,Version=v4.6.1.   
我错过了什么

更新

我将TestLibrary配置更改为:

"dependencies": {
  "NETStandard.Library": "1.5.0-rc2-24027",
},

"frameworks": {
  "netstandard1.5": {
    "imports": [
      "dnxcore50",
      "portable-net452+win81"
    ]
  }
}
但我有一个类库项目名TestLibraryTests with tests:

"testRunner": "xunit",

"dependencies": {
  "NETStandard.Library": "1.5.0-rc2-24027",
  "xunit": "2.2.0-beta1-build3239",
  "dotnet-test-xunit": "1.0.0-rc2-build10015",
  "TestLibrary": "1.0.0"
},

"frameworks": {
  "netstandard1.5": {
    "imports": [
      "dnxcore50",
      "portable-net452+win81"
    ]
  }
}   
但现在我得到了一个错误:

Package dotnet-test-xunit 1.0.0-rc2-build10015 is not compatible with netstandard1.5 (.NETStandard,Version=v1.5). Package dotnet-test-xunit 1.0.0-rc2-build10015 supports:
  - net451 (.NETFramework,Version=v4.5.1)
  - netcoreapp1.0 (.NETCoreApp,Version=v1.0)
One or more packages are incompatible with .NETStandard,Version=v1.5.

我错过了什么?我无法将XUnit与RC2一起使用?

当我尝试在不首先安装.NET Core RC2的情况下直接使用软件包时,我遇到了相同的错误:)

博客帖子:

下载:

添加类库包时,请确保选择的是.NET Core-->类库,但也要确保从下图中红色圆圈的下拉列表中选择正确的目标框架

然后,您的project.json应该如下所示:

    {
  "version": "1.0.0-*",

  "dependencies": {
    "Microsoft.EntityFrameworkCore": "1.0.0-rc2-final",
    "NETStandard.Library": "1.5.0-rc2-24027"
  },

  "frameworks": {
    "netstandard1.5": {
      "imports": [
        "dnxcore50",
        "portable-net452+win81"
      ]
    }
  }
}

小姐,你理解了我的问题。我安装了rc2,我正在使用它,没有任何问题。问题是当我创建一个类库项目发布它的包,然后尝试在web项目上使用它时。我尝试了你的建议,但现在我在类库测试中遇到了XUnit的问题。你知道怎么解决吗?我刚刚给我的问题添加了一个更新。谢谢,看起来您正在混合使用.net framework 4.5.2和4.5.1…选择一个版本,使用4.5.1,然后将所有框架更改为“portable-net45+win81”