Azure Function 2 - 缺少 using 指令或程序集引用?

Ric*_*ner 3 .net-assembly azure-functions

我使用 Visual Studio 2017 创建了我的 Azure Function v2。

我创建了一个新的队列触发器函数。

using System;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.Extensions.Logging;

namespace Functions
{
    public static class queue
    {
        [FunctionName("queue")]
        public static void Run([QueueTrigger("myqueue-items", Connection = "test")]string myQueueItem, ILogger log)
        {
            log.LogInformation($"C# Queue trigger function processed: {myQueueItem}");
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

但是找不到QueueTrigger的程序集

Error   CS0246  The type or namespace name 'QueueTriggerAttribute' could not be found (are you missing a using directive or an assembly reference?)
Error   CS0246  The type or namespace name 'QueueTrigger' could not be found (are you missing a using directive or an assembly reference?)
Error   CS0246  The type or namespace name 'Connection' could not be found (are you missing a using directive or an assembly reference?)
Run Code Online (Sandbox Code Playgroud)

Joe*_*Cai 6

正如 Nkosi 所说,您可以转到Azure Functions 的 Azure 队列存储绑定来检查是否配置了绑定扩展。

对于您的信息,我认为您需要安装Microsoft.Azure.WebJobs.Extensions.StorageNuGet 包,版本 3.x。然后一切都会正常进行。