2016-06-09 5 views
1

Wie fügen Sie notificationhubs-Bibliothek zur azure-Funktion hinzu? Dies ist mein Versuch, und es funktioniert nichtWie fügen Sie die notifcationhubs-Bibliothek hinzu

using System; 
using System.Threading.Tasks; 
using System.Collections.Generic; 
using Microsoft.Azure.NotificationHubs; 

public static void Run(string myQueueItem, TraceWriter log) 
{ 
    log.Info($"C# Queue trigger function processed: {myQueueItem}"); 
    Notification a; 

} 

Antwort

2

Wir NotificationHubs zur Liste der eingebauten Baugruppen hinzufügen, aber jetzt können Sie ein Paket Verweis auf NoficationHubs hinzufügen, indem Sie eine project.json Datei für Ihre Funktion (wie in der Dokumentation beschrieben here).

{ 
    "frameworks": { 
    "net46":{ 
     "dependencies": { 
     "Microsoft.Azure.NotificationHubs": "1.0.5" 
     } 
    } 
    } 
} 

Mit dem im Ort können Sie eine using-Anweisung für NotificationHubs, z.B .:

using System.Net; 
using Microsoft.Azure.NotificationHubs; 

public static HttpResponseMessage Run(
    HttpRequestMessage req, 
    TraceWriter log, 
    out Notification notification) 
{ 
    log.Info($"C# HTTP trigger function RequestUri={req.RequestUri}"); 

    // TODO 
    notification = null; 

    return req.CreateResponse(HttpStatusCode.OK); 
} 
+0

Dank hinzuzufügen! Klappt wunderbar! – user30646