3

We are using NotificationHubs version 1.0.9 with .NetCore 2.0 and .Net Framework 4.7.

At compile time, we get this warning:

"Package Microsoft.Azure.NOtificationHubs 1.0.9 was restored using '.NETFramework, version=4.6.1' instead of the project target framework '.NETCoreApp, version=2.0. this package may not be fully compatible with your project."

Everything is still built, but at runtime when this call is invoked:

RegistrationDescription hubRegistration = await hubClient.CreateAppleNativeRegistrationAsync(device.DeviceToken);  //hubClient is NotificationHubClient

We get this error:

Could not load file or assembly 'System.ServiceModel, Version=4.0.0.0

Has anyone encountered this before and have any idea how to fix it?

Nick is tired
  • 6,860
  • 20
  • 39
  • 51
user8290985
  • 249
  • 1
  • 2
  • 6

3 Answers3

2

At compile time, see this warning: "Package Microsoft.Azure.NOtificationHubs 1.0.9 was restored using '.NETFramework, version=4.6.1' instead of the project target framework '.NETCoreApp, version=2.0. this package may not be fully compatible with your project."

The Microsoft.Azure.NotificationHubs package requires .Net Framework 4.5 Full Profile. And here is a feedback Microsoft.Azure.NotificationHubs add support for .NET CORE.

AFAIK, if you create the ASP.NET Core Web Application with the target framework at .NetCore 1.0 or .NetCore 1.1, you could edit your *.csproj and change the TargetFramework to net461, then you could install and use Microsoft.Azure.NotificationHubs 1.0.9.

While for .NetCore 2.0 MVC, after you create the project, it would reference the Microsoft.AspNetCore.All 2.0.0, and this package supports netcoreapp2.0. I assumed that you could leverage Notification Hubs REST APIs and follow the git sample azure-notifications Send REST to access your notification hub for a workaround.

Bruce Chen
  • 18,207
  • 2
  • 21
  • 35
  • 1
    I upgraded to AspNETCore 2.0 and was under the assumption that since it works with .Net Framework 4.5, should be compatible with 4.7. The next option to try is as you suggested, the REST api route. We already had the code to connect with Microsoft.AzureNotificationHubs 1.0.9 and hoping didn't have to re-write all of that. Thanks for your suggestion and reply Bruce. -Jenny – user8290985 Oct 25 '17 at 14:25
  • For those using the Notification Hubs REST APIs, we were told from MS support team that the REST api will be deprecated within 6 months. – user8290985 Nov 10 '17 at 23:40
2

A preview version of a .NET Standard compatible NuGet is now available. It will allow using Notification Hubs with .NET core.

Karl
  • 116
  • 3
0

According to a Microsoft Product Manager a new version of the .NET SDK supporting .NET Core will be deployed very soon.

cf this question

But no mention on Feedback Microsoft site. I would recommend to vote for this feature