How To Refer Nuget Package In Azure Function V2.X

Ahamed Fazil Buhari
 
Senior Developer
December 15, 2018
 
Rate this article
 
Views
2338

Hello everyone,

In this article we will see how to refer nuget package in your azure function v2.x. Please make sure that your Azure function is version 2, because nuget package is referred differently in version 1 please refer my other article for v1.x – How to refer nuget package in Azure Function v1.x. To check your current azure function version, please follow the below step.

Go to Azure Portal (https://portal.azure.com/ ) -> open Function App, under Overview or Platform features tab there will be link Function app settings

In my function app, I’ve already created a simple HttpTrigger function as you can see from below screenshot

Now, I want to add the following nuget package – https://www.nuget.org/packages/SharePointPnPCoreOnline/ to my azure function, to do that we need to create a File called function.proj (but in v1.x this file name should be project.json)

 

paste the below XML in newly created function.proj file

 <Project Sdk="Microsoft.NET.Sdk">
 <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
   </PropertyGroup> 
   <ItemGroup>
     <PackageReference Include="SharePointPnPCoreOnline" Version="3.2.1810"/>
   </ItemGroup> 
 </Project>
 

 

And click on Save, if you need more than one nuget package to be installed, then please add another <PackageReference Include=”package-name ” Version=”version-num”/>

inside <ItemGroup> tag.

Once it’s saved, you can see from the log that the package is getting installed

After installation is over (it takes few seconds based on size of the package), I just referred Microsoft.SharePoint.Client dll to check and it worked.

Happy Coding

Ahamed

 

Category : Azure

Author Info

Ahamed Fazil Buhari
 
Senior Developer
 
Rate this article
 
Ahamed is a Senior Developer and he has very good experience in the field of Microsoft Technologies, especially SharePoint, Azure, M365, SPFx, .NET and client side scripting - JavaScript, TypeScript, ...read more
 

Leave a comment