ClosedXML / ClosedXML.Report

ClosedXML.Report is a tool for report generation with which you can easily export any data from your .NET classes to Excel using a XLSX-template.
https://closedxml.github.io/ClosedXML.Report/
MIT License
514 stars 108 forks source link

V0.2.6 Missing Assembly -- Irony #316

Closed ppereira-serviceonsites closed 10 months ago

ppereira-serviceonsites commented 1 year ago

When I update to V0.2.6 and run in Azure, I get the following error:

Exception has been thrown by the target of an invocation.Could not load file or assembly 'Irony, Version=1.0.11.0, Culture=neutral, PublicKeyToken=ca48ace7223ead47'.

If I downgrade to V0.2.4 the error goes away.


UPDATE: I thought I would update this instead of removing... as it is a legitimate issue BUT... it is a combination of using ClosedXML.Report in an Azure Function (.NET 7 - inline function)... Although I'm still not sure why downgrading seemed to work... maybe the way the ClosedXML project is defined is different?? Details below:

There are a number of posts out there about Azure Functions removing dll's it thinks you dont really need at compile time.. thereby causing this issue above at runtime.

In case anyone else encounters this... the solution I've found is to: 1) clone the ClosedXML project and use it as a project reference instead of a Nuget package 2) ensure that at the start of whatever Azure function in your code also make sure to use Irony and create a variable or some call into the library... In this way, the compiler is tricked into including the Irony.dll in the deployment.

Pankraty commented 10 months ago

@ppereira-serviceonsites please check if the issue persists in 0.2.7 or 0.2.8.

ppereira-serviceonsites commented 10 months ago

Hey @Pankraty ... this now seems to work in 0.2.8!!! YEAH!! Thank you!