Closed HerreraG closed 1 year ago
What NuGet packages (related to Swiss QR bill) does your project refer to? Do you have a .NET project for a Windows application, or another project type? Do you have a complex project with multiple subprojects? Is so, what does the project structure look like?
Hi @manuelbl, thank you for your help!
What NuGet packages (related to Swiss QR bill) does your project refer to?
Codecrete.SwissQRBill.Core 3.0.5 Codecrete.SwissQRBill.Generator 3.0.5 Net.Codecrete.QrCodeGenerator 2.0.0 QRCoder 1.2.9
Do you have a .NET project for a Windows application, or another project type?
ASP.NET Web API
Do you have a complex project with multiple subprojects?
No, I have a library class project where I have installed the Codecrete.SwissQRBill.Generator package and that is where I generate the QR bill. Then from the ASP.NET Web API project I add the library class project as a reference to generate the QR bill.
I can reproduce the problem in this specific configuration:
The problem is related to limitations of how NuGet packages are handled in old .NET projects using packages.config. The assembly Codecrete.SwissQRBill.Generator is not identified as a required dependency.
I've also found that Codecrete.SwissQRBill.Generator, which is based on SkiaSharp graphics library, doesn't nicely work with ASP.NET projects (or more likely the web server used).
Two changes are needed:
Change 1: Use the package Codecrete.SwissQRBill.Windows instead of Codecrete.SwissQRBill.Generator. That's the preferred choice for Windows only projects and for .NET Framework projects anyway.
Change 2: Create a direct reference to Codecrete.SwissQRBill.Windows, so it doesn't get left behind.
Option A: Add the NuGet package Codecrete.SwissQRBill.Windows to the main project, and not just to the class library.
Option B: Add the below static constructor to the class generating the QR bill:
static BillGeneratorClass()
{
new PNGCanvasFactory().Register();
}
Hello everyone!
I am upgrading from version 2.4.3 to version 3.0.5 and I get this exception when I want to generate the QR Bill in .PNG format.
Codecrete.SwissQRBill.Generator.QRBillGenerationException: 'Graphics format PNG not available (are you missing the NuGet package Codecrete.SwissQRBill.Generator?)'
Works well in SVG and PDF formats.
The framework of my project is .NET 4.6.1.
Supposedly this issue was fixed with version 3.0.1, in my case it is not. Graphics format PNG not available
Thank you in advance.