Paul
Paul

Reputation: 3253

ServiceBusTrigger not found in basic Azure Function project

I have created a brand new .NET Core 3.1 Azure Function project using the Visual Studio template

I am using V3 of the functions, i.e. the version created by the template

I have the latest VS - 16.10.2

Straight away, it fails with ServiceBusTrigger and Connection not found?

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

namespace AzureFunctionTest
{
    public static class Function1
    {
        [FunctionName("Function1")]
        public static void Run([ServiceBusTrigger("AzureFunctionTest", "Research Subscription", Connection = "eventbus-connection")]string mySbMsg, ILogger log)
        {
            log.LogInformation($"C# ServiceBus topic trigger function processed message: {mySbMsg}");
        }
    }
}

Really strange how a template from MS itself does not work and a bit concerning this fails on the first hurdle!!

Here are the relevant parts of my project file

 <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <AzureFunctionsVersion>v3</AzureFunctionsVersion>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Azure.Messaging.ServiceBus" Version="7.1.2" />
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.11" />
  </ItemGroup>

Azure.Messaging.ServiceBus seems to be the latest package and the one recommended to use

What am I missing?

Paul

Upvotes: 1

Views: 897

Answers (1)

user1672994
user1672994

Reputation: 10839

You should be using Microsoft.Azure.WebJobs.Extensions.ServiceBus package. Link.

You can read this official documentation for further information.

enter image description here

Upvotes: 4

Related Questions