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

asp.net-vnext中的旧程序集引用错误

发布时间:2020-12-15 19:49:00 所属栏目:asp.Net 来源:网络整理
导读:我正在使用VS2015 CTP5,我正在引用用4.5.1编译的遗留类库.在编译期间,我收到此警告: The primary reference “D:components.dll” could not be resolved because it was built against the “.NETFramework,Version=v4.5.1” framework. This is a higher
我正在使用VS2015 CTP5,我正在引用用4.5.1编译的遗留类库.在编译期间,我收到此警告:

The primary reference “D:components.dll” could not be resolved because it was built against the “.NETFramework,Version=v4.5.1” framework. This is a higher version than the currently targeted framework “.NETFramework,Version=v4.5”.

添加引用后,这是我的project.json

"frameworks": {
    "aspnet50": {
        "dependencies": {
            "components": "1.0.0-*"
        }
    }
},

解决方法

由于“组件”库是为.net 45构建的,并且假设您在较旧版本的visual studio中构建该库,它将无法在aspnetcore5中运行,但可以在aspnet5上运行(这些是.net的新版本).如果你想摆脱错误并仍然使用你的组件库,你需要从project.json文件中删除aspnetcore5 json节点,但你构建的项目将与aspnetcore5不兼容.所以你的frameworks部分的project.json文件应该是这样的.
"frameworks": {
    "aspnet50": {

        "frameworkAssemblies": {
            "System": "4.0.0.0"
        },"dependencies": {


        }
    },"net45": {
        "dependencies": {  "components": "1.0.0"},"frameworkAssemblies": { }

    }

}

你的引用应该是这样的,我在组件库旁边发出警告,因为我的代码中没有.

您可以查看此问题以获取更多信息.

Question 1,
Question 2

(编辑:李大同)

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

    推荐文章
      热点阅读