本文介绍了您的项目未引用“.NETFramework,Version=v4.5";框架.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 VS 2015.

您的项目未引用.NETFramework,Version=4.5"框架.在中添加对.NETFramework,Version=4.5"的引用project.json 的框架"部分,然后重新运行 NuGet恢复.

在添加到我的 MVC 层后不久,我在数据访问和业务逻辑层上收到此错误.在那之前一切都很好,但我不知道是什么触发了这个错误.这是我的 project.json:

{版本":1.0.0-*","description": "foo bar 类库",作者":[富吧"],标签":["],项目网址":","licenseUrl": "",构架": {net451":{},dotnet5.4":{依赖":{"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"}}}}

这是我尝试过的:

  1. 这个答案.

结果是同样的错误.

  1. 将dotnet5.4"替换为net45"并保留net451".这会导致一个新错误:

您的 project.json 没有运行时部分.你应该添加'"runtimes": { "win":{} }' 到你的 project.json 然后重新运行 NuGet恢复.

我尝试按照此错误的建议进行操作并添加

运行时":{赢":  {}},

这给了我这个错误,我似乎无法超越:

您的 project.json 没有将win"列为目标运行时.你应该在 project.json 的 "runtimes" 部分中添加 '"win": {}',然后重新运行 NuGet 还原.

我已经添加了win",这开始让人感觉像是一条红鲱鱼.我在做什么直接改变 project.json,NuGet 不是在处理这个吗?

解决方案

其实我只是想出了问题所在.我最终在解决方案级别单击 Restore Nuget Packages 并设法编译了我的 PCL 文件,然后是我的解决方案的其余部分.

希望这会有所帮助.

I am using VS 2015.

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"
      }
    }
  }
}

Here's what I have tried:

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

Result is the same error.

  1. Replacing "dotnet5.4" with "net45" and leaving the "net451". This results in a new error:

I tried doing as this error suggested and adding

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

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

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.

这篇关于您的项目未引用“.NETFramework,Version=v4.5";框架.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 12:26