.NETStandard1.6 PCL的错误:“您的项目未引用“ .NETPlatform,Version = v5.0”框架” [英] Error for .NETStandard1.6 PCL: "Your project is not referencing the ".NETPlatform,Version=v5.0" framework"

查看:153
本文介绍了.NETStandard1.6 PCL的错误:“您的项目未引用“ .NETPlatform,Version = v5.0”框架”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为帮助重现此问题,需要采取以下步骤在Visual Studio 2015中创建.NETStandard1.6 PCL:

To help reproduce the problem, the following steps are taken to create a .NETStandard1.6 PCL in Visual Studio 2015:


  1. 创建一个新的类库(可在iOS,Android和Windows上移植)。

  2. 在其属性页面中,单击 Target .NET Platform Standard。

  3. 将.NETStandard格式从.NETStandard1.1更改为.NETStandard1.6

  4. 构建此空项目。

  1. Create a new Class Library(Portable for iOS, Android and Windows).
  2. In its Properties page, click "Target .NET Platform Standard".
  3. Change .NETStandard form .NETStandard1.1 to .NETStandard1.6
  4. Build this empty project.

发生以下错误:

>C:\Program Files (x86)\MSBuild\Microsoft\NuGet\Microsoft.NuGet.targets(140,5): error : Your project is not referencing the ".NETPlatform,Version=v5.0" framework. Add a reference to ".NETPlatform,Version=v5.0" in the "frameworks" section of your project.json, and then re-run NuGet restore.

以下是project.json:

The following is project.json:

{
  "supports": {},
  "dependencies": {
    "Microsoft.NETCore.Portable.Compatibility": "1.0.1",
    "NETStandard.Library": "1.6.0"
  },
  "frameworks": {
    "netstandard1.6": {}
  }
}

任何人都可以提供有关如何添加对 .NETPlatform,Version = v5.0在框架部分中?我尝试了以下操作:

Could anyone offer a tip on how to Add a reference to ".NETPlatform,Version=v5.0" in the "frameworks" section? I tried the following:

donet5.4:{}

"donet5.4": {}

donet5.0:{ }

"donet5.0": {}

都不行。

推荐答案

在VS2015末尾.csproj文件中,添加:

For VS2015 at the very end of the .csproj file, add:

<PropertyGroup>
    <NuGetTargetMoniker>.NETStandard,Version=v1.6</NuGetTargetMoniker>
</PropertyGroup>

这篇关于.NETStandard1.6 PCL的错误:“您的项目未引用“ .NETPlatform,Version = v5.0”框架”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆