版本不符例外

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:

    // Enables automatic download of native binaries during runtime
    IronPdf.Installation.AutomaticallyDownloadNativeBinaries = true;
    // Enables automatic download of native binaries during runtime
    IronPdf.Installation.AutomaticallyDownloadNativeBinaries = true;
    ' Enables automatic download of native binaries during runtime
    IronPdf.Installation.AutomaticallyDownloadNativeBinaries = True
    $vbLabelText   $csharpLabel

    這將在首次執行時下載正確的原生二進位檔及依賴項。 請注意,此操作需要網路連線,且可能需要一些時間。

如需進一步協助,請提交工程支援請求

Curtis Chau
技術撰稿人

Curtis Chau 擁有卡爾頓大學(Carleton University)的電腦科學學士學位,專精於前端開發,並精通 Node.js、TypeScript、JavaScript 及 React。他熱衷於打造直觀且美觀的用戶介面,喜歡運用現代框架,並創建結構完善、視覺上吸引人的手冊。

除了開發工作之外,Curtis 對物聯網(IoT)抱有濃厚興趣,致力於探索整合硬體與軟體的創新方法。閒暇時,他喜歡玩遊戲和開發 Discord 機器人,將對科技的熱愛與創意相結合。

準備開始了嗎?
Nuget 下載 19,014,616 | 版本: 2026.5 just released
Still Scrolling Icon

還在往下捲動嗎?

想要快速確認成果嗎? PM > Install-Package IronPdf
執行範例 觀看您的 HTML 轉為 PDF。