ReadyToRun または 事前コンパイル (AOT) コンパイルを使用
.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
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
理由
Microsoftのドキュメントによると、SDKはアプリケーションとともに配布されるアセンブリを事前コンパイルします。 自己完結型アプリケーションの場合、このアセンブリセットにはフレームワークが含まれます。 C++/CLI のバイナリは ReadyToRun のコンパイル対象とはなりませんのでご注意ください。
ソリューション
特定のアセンブリをReadyToRun処理から除外するには、
<ItemGroup>
<PublishReadyToRunExclude Include="IronPdf.dll" />
</ItemGroup>
<ItemGroup>
<PublishReadyToRunExclude Include="IronPdf.dll" />
</ItemGroup>