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

查看:34
本文介绍了.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. 在其属性"页面中,单击目标 .NET 平台标准".
  3. 将 .NETStandard 从 .NETStandard1.1 更改为 .NETStandard1.6
  4. 构建这个空项目.

出现以下错误:

>C:Program Files (x86)MSBuildMicrosoftNuGetMicrosoft.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天全站免登陆