How to use "old" dependencies with ASP.NET 5

I created a new project using a clean install of VS 2015 Enterprise RC1, and I'm trying to add the Nuget package for Mandrill , which is built against .NET 4.

When I create a project, I get a message from DNX Core 5.0 that the namespace cannot be found:

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

Instead of adding as a global dependency, I tried to add it only to the dnx451 infrastructure in project.json with the same result.

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

Is it even possible to use .NET 4 packages with ASP.NET 5? If so, what is needed?

+6
source share
1 answer

The Mandrill package probably does not support CoreCLR. You have two options:

  • Remove CoreCLR support from your package by deleting the dnxcore50 section in project.json
  • Use conditional compilation and exclude calls to Mandrill api. Example: #if DXNCORE50 ... or #if DNX451
+11
source

Source: https://habr.com/ru/post/986332/


All Articles