版本不匹配异常

This article was translated from English: Does it need improvement?
Translated
View the article in English
Invalid assembly version for 'IronInterop' (actual: 2022.x.x.xxxx; expected: 2022.x.x.xxxx). This version of IronPdf requires updated native dependencies. Please clear your build output directory of old assemblies so IronPdf can automatically download the new dependencies at runtime. Alternatively, you may add NuGet package IronPdf.Native.Chrome version 2022.x.xxxx to your project and rebuild.

當 IronPdf.Slim 套件及其相依性因版本不匹配而不兼容時,會發生此錯誤。

可能的原因

通常當僅升級IronPDF.Slim套件,而其依賴項仍舊過時時,會出現此錯誤。

關鍵依賴項對於 IronPdf.Slim 包中包含:

這些依賴項可能不會自動隨著 IronPdf.Slim 更新,特別是在較舊的版本中。

解決方案

為了解決此問題,請考慮以下選項:

  • 重新安裝 IronPDF 套件:使用 Visual Studio 中的 NuGet 套件管理器卸載所有與 IronPDF 有關的套件,然後重新安裝最新版本。這可以確保舊的二進制文件被移除,防止運行時衝突。參見 NuGet 頁面 為相容的依賴版本。
  • 切換到 IronPDF: 卸載 IronPdf.Slim 及其依賴項,然後安裝完整的 IronPDF 套裝包。這會自動包括所有必要的依賴項和相容版本。
  • 啟用自動下載依賴項:卸載所提及的依賴項,並使用 IronPdf.Slim 和以下代碼:IronPdf.InstallationAutomaticallyDownloadNativeBinaries = true;。這將在初次運行時下載正確的原生二進制檔和依賴項。請注意,這需要網路連接,且可能需要一些時間。 工程需求 如果您需要進一步的協助。