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 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

相关文章

这篇文章主要讲解了“WPF如何实现带筛选功能的DataGrid”,文...
本篇内容介绍了“基于WPF如何实现3D画廊动画效果”的有关知识...
Some samples are below for ASP.Net web form controls:(fr...
问题描述: 对于未定义为 System.String 的列,唯一有效的值...
最近用到了CalendarExtender,结果不知道为什么发生了错位,...
ASP.NET 2.0 page lifecyle ASP.NET 2.0 event sequence cha...