Is Azure Notification Hubs package compatible with

2019-06-22 12:28发布

问题:

I'm working with a .NET core app, and I see some Azure packages are not compatible, for example NotificationHubs and SendGrid:

Package Microsoft.Azure.NotificationHubs 1.0.5 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0)
The dependency SendGrid.CSharp.HTTP.Client 2.0.4 does not support framework .NETCoreApp, Version=v1.0

I only tried adding NotificationHubs and SendGrid. I haven't even tried any ActiveDirectory packages yet.

Does anyone have any idea if some of these packages will be compatible soon? Or maybe I'm doing something wrong? Or is there a way in a .NET core app to reference an older package?

Thanks!

回答1:

[Update 11/30/2017] Microsoft.Azure.NotificationHubs 2.0.0-preview1 compatible with .NET Core has just been published.


[Original answer] As of mid-July 2016 Azure Notification Hubs SDK is not available for .NET core. The product team is working on it, but there's no ETA yet.

At the moment, there are two ways to work around it:

  • Use WindowsAzure.Messaging.Managed Nuget package as described in Getting started with Notification Hubs for Windows Universal Platform Apps
  • Through REST APIs. (List of methods.)


回答2:

If you are working on Azure, you are not required to use netcoreapp to use ASP.NET Core. You can still use ASP.NET Core with the Full Framework by targetting net461 instead of netcoreapp1.0 and it will still work, Azure has the Full Framework available and they are both compatible with the same version of NetStandard.

We have several Web Apps that run on netcoreapp1.0 and others on net461 due to package dependencies (like Azure SDKs), and all run on ASP.NET Core.

When the product team start releasing the .Net Core App compatible packages, just re-target netcoreapp1.0 and add the Microsoft.NETCore.App package and it will keep working.

Sample github repo of an Azure Web App using ASP.Net Core with Full Framework