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

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

问题描述

我正在使用VS 2015.

I am using VS 2015.

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

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.

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

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

这是我尝试过的:

  1. 结果是相同的错误.

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

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

    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:

    您的project.json没有列出"win"作为目标运行时.你应该 在project.json的运行时"部分内添加'"win":{}', 然后重新运行NuGet恢复.

    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.

    我已经添加了"win",这开始像红鲱鱼一样.我正在直接更改project.json,NuGet不处理此问题吗?

    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?

    推荐答案

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

    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.

    希望这会有所帮助.

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

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