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

.net – 在dotnet核心中使用不同的依赖版本结束

发布时间:2020-12-14 04:47:26 所属栏目:百科 来源:网络整理
导读:我正在开发一个针对netstandard1.6和net451的项目. 不幸的是,我在构建我的库时遇到了这些警告: C:Pathproject.json(22,35): warning NU1007: Dependency specified was Microsoft.CSharp = 4.0.1 but ended up with Microsoft.CSharp 4.0.0.0.C:Pathpro
我正在开发一个针对netstandard1.6和net451的项目.
不幸的是,我在构建我的库时遇到了这些警告:

C:Pathproject.json(22,35): warning NU1007: Dependency specified was Microsoft.CSharp >= 4.0.1 but ended up with Microsoft.CSharp 4.0.0.0.
C:Pathproject.json(17,38): warning NU1007: Dependency specified was System.Collections >= 4.0.11 but ended up with System.Collections 4.0.0.0.
C:Pathproject.json(18,30): warning NU1007: Dependency specified was System.Linq >= 4.1.0 but ended up with System.Linq 4.0.0.0.
C:Pathproject.json(19,33): warning NU1007: Dependency specified was System.Runtime >= 4.1.0 but ended up with System.Runtime 4.0.10.0.
C:Pathproject.json(20,49): warning NU1007: Dependency specified was System.Runtime.InteropServices >= 4.1.0 but ended up with System.Runtime.InteropServices 4.0.10.0.
C:Pathproject.json(21,36): warning NU1007: Dependency specified was System.Threading >= 4.0.11 but ended up with System.Threading 4.0.0.0.

这是我的project.json:

{
    "version": "1.0.0-*","description": "MyLibrary","frameworks": {
        "net451": {
        },"netstandard1.6": {
        }
    },"dependencies": {
        "NETStandard.Library": "1.6.0","Newtonsoft.Json": "9.0.1","MyOtherProject.Common": "1.0.0-*","System.Collections": "4.0.11","System.Linq": "4.1.0","System.Runtime": "4.1.0","System.Runtime.InteropServices": "4.1.0","System.Threading": "4.0.11","Microsoft.CSharp": "4.0.1"
    }
}

该库构建时没有针对netstandard1.6和net451的错误,但是在构建net451时我收到了这些警告.

有任何想法吗?

解决方法

我有同样的问题.
我的修复,删除警告是

{
  "version": "1.0.0-*","frameworks": {
    "net451": {
      "dependencies": {
        "System.Collections": "4.0.0","System.Linq": "4.0.0","System.Runtime": "4.0.10","System.Runtime.InteropServices": "4.0.10","System.Threading": "4.0.0","Microsoft.CSharp": "4.0.0"
      }
    },"netstandard1.6": {
      "dependencies": {
        "System.Collections": "4.0.11","Microsoft.CSharp": "4.0.1"
      }
    }
  },"dependencies": {
    "NETStandard.Library": "1.6.0","Newtonsoft.Json": "9.0.1"
  }
}

但我认为可能会有更好的解决方案.

(编辑:李大同)

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

    推荐文章
      热点阅读