2016-06-09 13 views
1

如何將notificationhubs庫包含到azure函數中?這是我的嘗試,它不起作用如何添加notifcationhubs庫

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; 

} 

回答

2

我們將添加NotificationHubs到內置在組件列表中,但現在你可以通過添加project.json文件的功能(如文檔here中所述)添加到NoficationHubs一攬子參考。

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

由於在地方,你可以添加一個using語句NotificationHubs,例如:

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

謝謝!奇蹟般有效! – user30646