1
votes

I'm using Azure Function through the Azure Portal for Queue Triggers and I want to add a NuGet Package to it.

There is only two files "run.csx" & "function.json"

The function.json just contains the binding information. However, how do I add a NuGet package such as "Azure.Messaging.ServiceBus" to that function.json. I can't seem to find a clear document or explanation on how to do so.

1
Are you asking how to add a nuget package to a project that contains an Azure function? - Neil
Basically, I want to add a nuget package to my azure function I have currently - Kevin Jones

1 Answers

1
votes

Per the documentation, for C# Script (.csx) functions, you can upload a function.proj file that contains a PackageReference to a nuget package. This is similar to a .csproj file. In your case, it should probably be like so:

<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <TargetFramework>netstandard2.0</TargetFramework>
    </PropertyGroup>

    <ItemGroup>
        <PackageReference Include="Azure.Messaging.ServiceBus" Version="7.1.2" />
    </ItemGroup>
</Project>