C# net framework4.8框架中使用使用QuestPDF各种报错,System.IO.FileNotFoundException:“未能加载文件或程序集...,以及,DllNotFoundException: 无法加载 DLL“QuestPdfSkia”: 找不到指定的模块,
最近要做一个生成pdf报告的小功能,搜索一番之后,选择了QuestPDF这个库
由于我是要在net framework4.8中实现功能,可能使用场景太老了,导致使用过程一波三折,非常的坎坷,折腾了一下午,增长了一些经验,记录下来
1,如果你要在net framework4.8框架中使用,就不要自作聪明的用netstandard2.0框架来实现业务,本来以为netstandard2.0可以被net framework4.8中调用,也可以被net6调用,就想着心代码尽量写在netstandard2.0中,结果悲剧了,编译正常,但是dll根本就拷贝不过去,运行程序,直接报错 System.IO.FileNotFoundException:“未能加载文件或程序集...
2,老老实实在net framework4.8类库中引用QuestPDF,实现业务,结果又报错了,一大串,
System.Exception:“QuestPDF is a modern open-source library. We identify the importance of the library in your projects and therefore want to make sure you can safely and confidently continue the development. Being a healthy and growing community is the primary goal that motivates us to pursue professionalism.
Please refer to the QuestPDF License and Pricing webpage for more details. (https://www.questpdf.com/license/)
If you are an existing QuestPDF user and for any reason cannot update, you can stay with the 2022.12.X release with the extended quality support but without any new features, improvements, or optimizations. That release will always be available under the MIT license, free for commercial usage. We are planning to sunset support for the 2022.12.X branch around Q1 2024. Until then, it will continue to receive quality and bug-fix updates.
The library does not require any license key. We trust our users, and therefore the process is simple. To disable license validation and turn off this exception, please configure an eligible license using the QuestPDF.Settings.License API, for example:
"QuestPDF.Settings.License = LicenseType.Community;"
Learn more on: https://www.questpdf.com/license/configuration.html
这是因为授权许可的问题,这个库默认开启许可证验证,需要手动指定一下使用场景,只需要在使用前加上QuestPDF.Settings.License = LicenseType.Community这段代码就行了
3,指定了许可证后,还是报错,DllNotFoundException: 无法加载 DLL“QuestPdfSkia”: 找不到指定的模块...,这是因为应用程序生成的时候默认勾选了“首选32位”,只需要右键net framework4.8应用程序》生成》常规》首选32位,把勾选去掉就行了
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· .NET10 - 预览版1新功能体验(一)