MvcRazorToPdf 安装问题

MvcRazorToPdf installation issues

我正在尝试查看 MvcRazorToPdf。我正在从 Nuget Manager 安装它。 当我尝试构建项目时,我收到此错误消息:

Error 5 Assembly 'MvcRazorToPdf, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'itextsharp, Version=5.5.3.0, Culture=neutral, PublicKeyToken=8354ae6d2174ddca' which has a higher version than referenced assembly 'itextsharp, Version=5.5.0.0, Culture=neutral, PublicKeyToken=8354ae6d2174ddca' d:\PROJECTS\Crowdiet\packages\MvcRazorToPdf.1.0.2\lib\MvcRazorToPdf.dll Crowdiet

为了解决这个问题,我从 Nuget 安装了最新版本的 iTextSharp。版本 5.5.7 现在我正在构建,所以它可以运行。

但是,在尝试执行 MvcRazorToPdf 代码时,我收到以下错误消息:

Could not load file or assembly 'itextsharp.xmlworker, Version=5.5.3.0, Culture=neutral, PublicKeyToken=8354ae6d2174ddca' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileLoadException: Could not load file or assembly 'itextsharp.xmlworker, Version=5.5.3.0, Culture=neutral, PublicKeyToken=8354ae6d2174ddca' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

有什么办法处理这个问题吗?谢谢

DSB 我写这篇文章是因为评论太多了。

此 link 应该有助于解决您的天蓝色查询 SO

关于我所说的关于更新您的 wkhtml 文件的内容,您需要单击此 link wkhtml download (this is a link for the site wkhtml page),因为这将为您提供 rotativa 所需的 3 个更新文件。下载完成后,您可以执行两件事,以便将这些新文件添加到您的解决方案中。此下载会将包含 3 个文件的安装程序保存到您的计算机。保存文件时,请记下将它们保存到的位置。

  1. 下载在 7zip 找到的 7 zip 或任何文件解压工具(如果您还没有的话)。右键单击您的下载并使用提取工具提取并保存 3 个更新文件。

    1. 如果您无法下载或没有提取工具,那么运行下载文件的设置。这应该保存到标准驱动器中的程序文​​件中。通过程序文件导航到 wkhtmltopdf 文件夹,单击它,然后单击 bin 文件夹,您将在其中找到 3 个更新的 wkhtml 文件。

获得这三个文件后,将它们添加到解决方案中现有的 rotativa 文件夹中。如有必要,请重建灵魂以更新它。希望这对您有所帮助!!