加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net – 在.NET Framework中引用库而不是.NET Standard

发布时间:2020-12-16 09:56:02 所属栏目:asp.Net 来源:网络整理
导读:我目前正在从DNX(RC1)将类库项目迁移到dotnet cli(RC2).以前,该项目引用了.NET v4.5.1框架库,而project.json文件如下所示: "frameworks": { "net451": { "frameworkAssemblies": { "System.Runtime": "4.0.10.0","System.Web": "4.0.0.0","System.Directory
我目前正在从DNX(RC1)将类库项目迁移到dotnet cli(RC2).以前,该项目引用了.NET v4.5.1框架库,而project.json文件如下所示:

"frameworks": {
    "net451": {
      "frameworkAssemblies": {
        "System.Runtime": "4.0.10.0","System.Web": "4.0.0.0","System.DirectoryServices": "4.0.0.0","System.DirectoryServices.AccountManagement": "4.0.0.0","System.ServiceModel": "4.0.0.0","System.ServiceModel.Security": "4.0.0.0"
      }
    }
  }

现在据我所知,(我可能错了),与DNX不同,新的dotnet Cli不支持.NET 4.5.1,而是支持.NET Standard.

问题是,.NET Standard没有我想要的所有库.我需要更改什么才能引用.NET 4.5.1框架库?我读到了有关进口声明的内容,但我无法让它发挥作用.这是我到目前为止(更新):

"frameworks": {
    "net451": {
      "frameworkAssemblies": {
        "System.Runtime": "4.0.10.0","System.ServiceModel.Security": "4.0.0.0"
      }
    },"netstandard1.5": {
      "imports": [ "dnxcore50","portable-net451+win8" ]
    }
  }

我得到的错误如下:

Cannot reference ParallelQuery

我有点失去了我还需要做什么…有什么想法吗?

解决方法

dotnet支持net451. Here’s an example of application that has both net451 and netstandard.

如果您的应用程序在RC1中的完整桌面上运行,那么在RC2中将其迁移到完整桌面应该没有问题.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读