【发布时间】:2022-02-23 23:18:00
【问题描述】:
我使用 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}");
}
}
}
但是找不到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?)
【问题讨论】:
-
我建议重新检查文档以确保您正确配置了所有内容。 docs.microsoft.com/en-us/azure/azure-functions/…
-
Visual Studio 2017 存在一个错误。当我使用空白选项创建新的 Azure 函数项目时。发生此错误。但是如果我使用一些模板创建,这个错误就不会发生。
-
遗憾的是,截至 2020 年 9 月 21 日的最新 VS 2019 更新,此问题仍未修复。据我了解,这些模板现在带有核心 VS 更新,而不是单独的工具/扩展更新,除非有人知道不同?只是想确定在哪里报告。
-
在这里安装这些包救了我stackoverflow.com/a/61493781/5937760
标签: azure-functions .net-assembly