'Assembly could not be find in azure function

I am new to Azure Functions and facing the issue related to assembly. Problem :

  1. I want to read a PPT file which is being uploaded in Sharepoint.
  2. Using Power Automate to start a flow which sends the file content to Azure function.
  3. Azure function should read the content of PPT file.

I have added DocumentFormat.OpenXml (version - 2.13.0) and System.IO.Packaging (version 6.0.0) to bin folder

the code I have written is compiled without errors but when I run the code to test it gives assembly error, please refer to the images.

I have read that it is a known issue that Azure function removes assembly during runtime and this property _FunctionsSkipCleanOutput can be updated but if this is a solution then how to do this via portal?

I am using Azure Portal only. enter image description here

enter image description here

#r "Newtonsoft.Json"
#r "System.IO.Packaging.dll"
#r "DocumentFormat.OpenXml.dll"
using System.Net;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Primitives;
using Newtonsoft.Json;
using System.Text;
using System;
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging;
using System.IO.Packaging;
using DocumentFormat.OpenXml.Presentation;
public static async Task<IActionResult> Run(HttpRequest req, ILogger log)
{
log.LogInformation("C# HTTP trigger function processed a request.");

//string name = req.Query["name"];

string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
dynamic data = JsonConvert.DeserializeObject(requestBody);
string file=data?.file;
byte[] filarray=Convert.FromBase64String(file);
MemoryStream m=new MemoryStream();
m.Write(filarray,0,filarray.Length);
int count=0;
using (PresentationDocument presnt=PresentationDocument.Open(m,true))
{
        PresentationPart p=presnt.PresentationPart;
        if(p!=null)
        {
            count=p.SlideParts.Count();
        }

}
//name = name ?? data?.name;

string responseMessage = string.IsNullOrEmpty("jogi")
    ? "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response."
            : Convert.ToString(count);
            //:file;
        return new OkObjectResult(responseMessage);
}


Solution 1:[1]

I couldn't get the above working rather I tried to make the azure function using visual studio code and I could read the PPT file by adding reference to OpenXml.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 user2889674