猿问

无法在C#Azure函数中使用Nuget程序包

我正在尝试编写一个将使用Sendgrid发送电子邮件的天蓝色函数。但是,我无法获得识别外部nuget包的功能。这是我所拥有的:


project.json


{

"frameworks": {

    "net46": {

        "dependencies": {

            "SendGrid": "9.9.0"

        }

    }

  }

}

run.csx:


using System;

using Sendgrid;


public static void Run(TimerInfo myTimer, TraceWriter log)

{

    var client = new SendGridClient("xxx");

    var fromAddr = new EmailAddress("xxx@xxx.com", "xxx");

    var toAddr = new EmailAddress("xxxx", "xxx);

    var msg = MailHelper.CreateSingleEmail(fromAddr, toAddr, "subject", "content", "content");

    client.SendEmailAsync(msg).Wait();

}

我收到此错误:


[Error] run.csx(8,7): error CS0246: The type or namespace name 'Sendgrid' could not be found (are you missing a using directive or an assembly reference?)

我想念什么?


芜湖不芜
浏览 139回答 1
1回答
随时随地看视频慕课网APP
我要回答