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

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

我使用干净安装的VS 2015 Enterprise RC1创建了一个新项目,我正在尝试为 Mandrill添加一个针对.NET 4构建的Nuget包. 当我构建项目时,我从DNX Core 5.0收到错误,找不到命名空间: All packages are already installed and there is nothing to restore.NuGet p

我使用干净安装的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:\Projects\WebApplication3\src\WebApplication3\MessageServices.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

本文来自网络,不代表云浮站长网立场。转载请注明出处: https://www.0766zz.com/html/kaifa/asp-net/20200901/9037.html
上一篇
下一篇

作者: dawei

【声明】:云浮站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。

为您推荐

返回顶部