依赖性不支持框架.NETStandard,Version = v1.6,Visual Studio 2015.3

时间:2017-02-17 11:47:01

标签: c# asp.net-core .net-core

我在.Net Core Visual Studio 2015.3中创建了一个.Net类库:https://www.nuget.org/packages/MD.PersianDateTime.Core/

上述包

Project.json

{
  "authors": [ "Mohammad Dayyan" ],
  "copyright": "By Mohammad Dayyan, 0903-3339923",
  "dependencies": {
    "NETStandard.Library": "1.6.1"
  },
  "description": "C# library to use PersianCalendar as easy as DateTime",
  "frameworks": {
    "netstandard1.6": {
      "imports": "dnxcore50"
    }
  },
  "licenseUrl": "http://www.gnu.org/licenses/gpl-3.0-standalone.html",
  "name": "MD.PersianDateTime.Core",
  "title": "PersianDateTime",
  "version": "1.0.0-*",
  "buildOptions": {
    "xmlDoc": true
  }
}

现在,我想在另一个.Net核心类库中使用它,使用以下package.json

{
  "dependencies": {
    "NETStandard.Library": "1.6.1",
    "Newtonsoft.Json": "9.0.1",
    "MD.PersianDateTime.Core": "1.0.0.1"
  },
  "frameworks": {
    "netstandard1.6": {
      "imports": "dnxcore50"
    }
  },
  "name": "Another .Net Core Class Library",
  "version": "1.0.0-*"
}

但是我在编译中遇到以下错误:

Severity    Code    Description Project File    Line    Suppression State
Error   NU1002  The dependency MD.PersianDateTime.Core 1.0.0.1 does not support framework .NETStandard,Version=v1.6.    SmartizCore C:\Works\SmartizCore\src\SmartizCore\project.json   7   

修改
我从以下链接安装了最新版本的.Net Core SDK和Runtime:
https://github.com/dotnet/core/blob/master/release-notes/rc4-download.md 所以我的.Net Core版本如下:

.Net Core version in CMD
但在视觉工作室我得到以下版本

.Net Core version in VS

3 个答案:

答案 0 :(得分:1)

将您的dotnet核心版本更新为最新(最新版本)---> link

enter image description here

然后您还需要在global.json

中更新此版本号
 "version": "1.0.0-preview2-1-003177"

答案 1 :(得分:1)

您应该更新.net核心版本 - > current version

确保单击“当前”按钮以查看.NET Core 1.1下载链接。

答案 2 :(得分:0)

我安装了Visual Studio 2017版本15.0.26206.0 它没有任何问题。

https://github.com/dotnet/cli/issues/5755