版本不匹配异常
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 包的关键依赖包括:
- Iron Software.Common
- IronSoftware.System.Drawing
- IronPdf.Native.Chrome
- IronPDF.Native.Chrome.Windows (适用于 Windows)
- IronPDF.Native.Chrome.Linux (适用于 Linux)
- Iron Software.Native.PdfModel
这些依赖可能不会与 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这将在首次运行时下载正确的本机二进制文件和依赖。 请注意,这需要互联网连接,并可能需要一些时间。
如果需要进一步的帮助,请提交工程请求。






