Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Function 2 - missing a using directive or an assembly reference?

I created my Azure Function v2 using Visual Studio 2017.

I created a new Queue Trigger function.

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}");
        }
    }
}

But the assembly of QueueTrigger could not be found

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?)
like image 386
Richard Lindner Avatar asked Sep 01 '26 08:09

Richard Lindner


1 Answers

As Nkosi said, you could go to Azure Queue storage bindings for Azure Functions to check if you have configure binding extensions.

For your info, I think you need to install Microsoft.Azure.WebJobs.Extensions.Storage NuGet package, version 3.x. Then everything will work fine.

like image 130
Joey Cai Avatar answered Sep 04 '26 17:09

Joey Cai



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!