版本不匹配异常

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;。这将在初次运行时下载正确的本机二进制文件和依赖项。请注意,这需要互联网连接并且可能需要一些时间。

    工程要求 如需进一步帮助。