您的项目没有引用“.NETFramework,Version=v4.5"框架. [英] Your project is not referencing the ".NETFramework,Version=v4.5" framework.

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

问题描述

我使用的是 VS 2015.

<块引用>

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

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

<代码>{"版本": "1.0.0-*","description": "foo bar 类库","authors": [ "foo bar" ],标签":["],"projectUrl": "","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. 将dotnet5.4"替换为net451"(并删除它),如这个答案.

结果是同样的错误.

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

<块引用>

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

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

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

这给我带来了这个错误,我似乎无法摆脱:

<块引用>

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

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

解决方案

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

希望这会有所帮助.

I am using VS 2015.

Your project is not referencing the ".NETFramework,Version=4.5" framework. Add a reference to ".NETFramework,Version=4.5" in the "frameworks" section of your project.json, and then re-run NuGet restore.

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:

Your project.json doesn't have a runtimes section. You should add '"runtimes": { "win":{} }' to your project.json and then re-run NuGet restore.

I tried doing as this error suggested and adding

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

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

Your project.json doesn't list 'win' as a targeted runtime. You should add '"win": {}' inside your "runtimes" section in your project.json, and then re-run NuGet restore.

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"框架.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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