User101
User101

Reputation: 858

Can't reference Polly or other packages in Azure Functions

I have tried the below in a version 4 Azure Function app

#r "Polly"
using System;
using System.Threading.Tasks;

and/or

using System;
using System.Threading.Tasks;
using Polly;

But in both cases it says Polly is not found. From the docs I tried to add a framework 46 reference too in the json file for the function app but that did not work. What is the best way to import a dependency?

Upvotes: 0

Views: 654

Answers (1)

anon
anon

Reputation:

One of the workaround to install Polly dependency injection in Azure Functions v4 is:

  • Open the Azure Functions V4 Project.
  • Right-click on the project > Click on Manage Nuget Packages
  • Install the required extensions for your project like

enter image description here

Start writing the code related to Polly policies extension in the function class like:

enter image description here

The ways to add the dependency injections in the Azure Functions is:

  1. Installing the Dependency Injections using NuGet Package Manager by right clicking on the project. Or
  2. Using the DotNet CLI or Package Manager commands available in the NuGet official Site.

Upvotes: 1

Related Questions