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?
CodePudding user response:
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

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

The ways to add the dependency injections in the Azure Functions is:
- Installing the Dependency Injections using NuGet Package Manager by right clicking on the project. Or
- Using the DotNet CLI or Package Manager commands available in the NuGet official Site.
