1

What NuGet package should I be using to access the Twilio API from my ASP.NET Core MVC 5.0 project?

My ASP.NET Core project file targets net5.0. I include the Twilio.AspNet.Mvc NuGet package (latest version).

When my project builds, I get a bunch of warnings telling me that something is pulling in obsolete versions of Microsoft assemblies.

For example:

Warning NU1701 Package 'Microsoft.AspNet.Mvc 3.0.20105.1' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework 'net5.0'. This package may not be fully compatible with your project.

After a bit of sleuthing, it appears that the problem is because Twilio.AspNet.Mvc (v5.37.2) pulls in, among other things, Microsoft.AspNet.Mvc (v3.0.20105.1).

That package has a warning:

Package 'Twilio.AspNet.Mvc 5.37.2' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework 'net5.0'. This package may not be fully compatible with your project.

I tried removing and reinstalling the Twilio package, but that didn't help.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Bob.at.Indigo.Health
  • 11,023
  • 13
  • 64
  • 111

1 Answers1

3

The package documentation says that you should use Twilio.AspNet.Core.

omajid
  • 14,165
  • 4
  • 47
  • 64
  • 1
    I was led astray by Microsoft's confusing nomenclature (see https://stackoverflow.com/a/51391202). The documentation for the Twilio.AspNet.Core package says it is "for use with ASP.NET Core 1-2 on .NET Core". I thought I had read that Microsoft was calling the latest EVERYTHING ".Net 5" and "ASP.Net Core 5" (or some such). I assumed that the Twilio.AspNet.Core package was now obsolete. Silly me. – Bob.at.Indigo.Health Aug 17 '21 at 01:11
  • @Bob.at.Indigo.Health That doesn't surprise me. Microsoft is doing a great job at naming things and not making them confusing, as usual ;) Anyways, I have updated the readme file for the library. Hopefully it'll avoid confusion. – Swimburger Mar 24 '22 at 21:12