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

标签 asp.net asp.net-core

我正在使用 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不兼容。因此,您的框架部分的project.json 文件应如下所示。

"frameworks": {
    "aspnet50": {

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


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

    }

}

你的引用应该看起来像,我在组件库旁边发出警告,因为我的代码中没有它。

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

Question 1 , Question 2

关于asp.net - asp.net-vnext 中的旧程序集引用错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28289747/

相关文章:

asp.net-core - .AddOAuth() 与 .AddOpenIdConnect()

asp.net-core - 有没有办法 "Hot Publish".NET Core 应用程序?

jquery - 将 css 样式添加到动态生成的元素(jquery、css)

asp.net - Jquery隐藏字段

c# - ASP.NET 如何在特定时间自动发送电子邮件

c# - ASP.NET Core 3.1 中的证书认证实现

ASP.NET 5 HTML5 历史

asp.net - .Net 核心路由 URLEncoded URL 不工作

c# - 如何格式化 mssql 日期时间列以仅在网页输入字段上显示时间?

asp.net - ASP.NET 中使用 Web 表单的静态控件和动态控件有什么区别