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

asp.net-core – 如何在ASP.NET 5中使用“旧”依赖项

发布时间:2020-12-15 20:56:38 所属栏目:asp.Net 来源:网络整理
导读:我使用干净安装的VS 2015 Enterprise RC1创建了一个新项目,我正在尝试为 Mandrill添加一个针对.NET 4构建的Nuget包. 当我构建项目时,我从DNX Core 5.0收到错误,找不到命名空间: All packages are already installed and there is nothing to restore.NuGet
我使用干净安装的VS 2015 Enterprise RC1创建了一个新项目,我正在尝试为 Mandrill添加一个针对.NET 4构建的Nuget包.

当我构建项目时,我从DNX Core 5.0收到错误,找不到命名空间:

All packages are already installed and there is nothing to restore.
NuGet package restore finished.
1>------ Build started: Project: WebApplication3,Configuration: Debug Any CPU ------
1>C:ProjectsWebApplication3srcWebApplication3MessageServices.cs(5,7,5,15): DNX Core 5.0 error CS0246: The type or namespace name 'Mandrill' could not be found (are you missing a using directive or an assembly reference?)
1>
1>  Build failed.
1>           0 Warning(s).
1>           1 Error(s).
1>
1>  Time elapsed 00:00:00.1404086
1>
========== Build: 0 succeeded or up-to-date,1 failed,0 skipped ==========

我试图将它添加到project.json中的dnx451框架,而不是添加为全局依赖项,结果相同.

"frameworks": {
    "dnx451": {
        "dependencies": {
            "Mandrill": "1.3.1"
        }
    },"dnxcore50": { }
},

甚至可以在ASP.NET 5中使用.NET 4包吗?如果是这样,需要什么?

解决方法

可能Mandrill包不支持CoreCLR.您有两种选择:

>通过删除project.json中的dnxcore50部分,从包中删除对CoreCLR的支持>使用条件编译并排除对Mandrill api的调用.示例:#if DXNCORE50 …或#if DNX451

(编辑:李大同)

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

    推荐文章
      热点阅读