我用的是VS 2015.

您的项目没有引用".NETFramework,版本=4.5"

I am getting this error on my Data Access and Business Logic layers, shortly after adding to my MVC Layer. Things were building fine until then, but I don't know what triggered this error. Here is my project.json:

{
  "version": "1.0.0-*",
  "description": "foo bar Class Library",
  "authors": [ "foo bar" ],
  "tags": [ "" ],
  "projectUrl": "",
  "licenseUrl": "",

  "frameworks": {
    "net451": { },
    "dotnet5.4": {
      "dependencies": {
        "Microsoft.CSharp": "4.0.1-beta-23516",
        "System.Collections": "4.0.11-beta-23516",
        "System.Linq": "4.0.1-beta-23516",
        "System.Runtime": "4.0.21-beta-23516",
        "System.Threading": "4.0.11-beta-23516"
      }
    }
  }
}

以下是我try 过的:

  1. Replacing "dotnet5.4" with "net451" (and deleting it) as found in this answer.

Result is the same error.

  1. 将"dotnet5.4"改为"net45",留下"net451".这会导致新的错误:

你的项目.json没有运行时部分.你应该加上

我试着按照这个错误提示的那样做,并添加了

"runtimes": {
    "win":  {}
  },

This got me this error, which I can't seem to move past:

你的项目.json没有将"win"列为目标运行时.你应该

I've already added "win", and this is beginning to feel like a red herring. What am I doing altering the project.json directly, isn't NuGet handling this?

推荐答案

I actually just figured out the problem. I ended up clicking on Restore Nuget Packages at the solution level and I managed to compile my PCL file, and then the rest of my solution.

Hope this helps.

Json相关问答推荐

JOLT规范:转移到现有数组

嵌套自定义解组

按照对象键的值对PostgreSQL JSONB对象进行排序'

我发现GoFr响应总是包含在数据字段中,如何返回自定义响应?

Jolt - 如何比较 if else 条件的两个值

json 字符串到 Postgres 14 中的表视图

遍历 JSON,检索父值

如何在linux中用jq过滤json数组?

使用 System.Text.Json 序列化记录成员

如何解决名为 null 的map值

如何使用 Swiftui 判断 JSON 是否缺少键值对

避免 KeyError 的默认字典键

将 JSON 数据导入 Google 表格

Swift :将 struct 转换为 JSON?

Spring restTemplate 获取原始 json 字符串

使用 C# 调用 json

处理 HTTP 请求正文中的可选 JSON 字段

C++:使用 nlohmann json 从文件中读取 json 对象

从调试器获取 IntelliJ Idea 中的 JSON 对象

仅使用字符串和值解析 JSON 对象