使用 ReadyToRun 或预先编译 (AOT)
This article was translated from English: Does it need improvement?
TranslatedView the article in English
.NET ReadyToRun(R2R)是一种提前编译的形式(AOT)编译
在部署期间启用 ReadyToRun 编译可能会违反防篡改保护,并导致出现以下异常。
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronPdf, Version=2024.2.0.2, Culture=neutral, PublicKeyToken=94e1c31412563c75 assembly is not authentic. Please try to reinstall the nuget package
at IronPdf.PdfDocument.uswvws(Boolean vhfwdf)
at IronPdf.PdfDocument.get_BinaryData()
at IronPdf.PdfDocument.SaveAs(String FileName, Boolean SaveAsRevision)
at Program.<Main>$(String [] args) in C:\csharppro\aottest\aottest\Program.cs:line 5
原因
根据微软的文档,SDK将预编译与应用程序一起分发的程序集。 对于独立应用程序,此程序集集将包括框架。 请注意,C++/CLI 二进制文件不支持 ReadyToRun 编译。
解决方案
要从ReadyToRun处理中排除特定程序集,请使用
<ItemGroup>
<PublishReadyToRunExclude Include="IronPdf.dll" />
</ItemGroup>
XML