Visual Studios 2015 NuGet Ghostscript 安装错误

Visual Studios 2015 NuGet Ghostscript Installation Error

我似乎无法弄清楚如何解决 gsdll32

的安装错误

我是运行64位windows和visual studios 2015。我唯一能想到的是nuget试图在64位版本的visual studio上安装32位dll .但我似乎无法与其他任何人确认这个错误。我需要 Ghostscript 将网站上的 PDF 转换为 JPG。如果您有 Ghostscript 的替代品,请告诉我。安装 Visual Studios Ghostscript.NET 就好了。但它在 ghostscript 本身上失败了。

PM> Install-Package Ghostscript -Version 9.2.0
Attempting to gather dependency information for package 'Ghostscript.9.2.0' with respect to project 'wilcox_fresh', targeting '.NETFramework,Version=v4.6.1'
Gathering dependency information took 845.32 ms
Attempting to resolve dependencies for package 'Ghostscript.9.2.0' with DependencyBehavior 'Lowest'
Resolving dependency information took 0 ms
Resolving actions to install package 'Ghostscript.9.2.0'
Resolved actions to install package 'Ghostscript.9.2.0'
Retrieving package 'Ghostscript 9.2.0' from 'nuget.org'.
Adding package 'Ghostscript.9.2.0' to folder 'C:\Users\Neoaptt\Source\Repos\wilcoxfreshsite\packages'
Added package 'Ghostscript.9.2.0' to folder 'C:\Users\Neoaptt\Source\Repos\wilcoxfreshsite\packages'
Install failed. Rolling back...
Package 'Ghostscript.9.2.0' does not exist in project 'wilcox_fresh'
Removing package 'Ghostscript.9.2.0' from folder 'C:\Users\Neoaptt\Source\Repos\wilcoxfreshsite\packages'
Removed package 'Ghostscript.9.2.0' from folder 'C:\Users\Neoaptt\Source\Repos\wilcoxfreshsite\packages'
Executing nuget actions took 460.6 ms
Install-Package : Failed to add reference to 'gsdll32'.
At line:1 char:1
+ Install-Package Ghostscript -Version 9.2.0
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Time Elapsed: 00:00:01.4721036

Visual Studios 2015 NuGet Ghostscript Installation Error

那是因为 gsdll32.dll 是本机 dll,而不是非托管 .NET 库。所以你不能在你的项目中安装它。您可以下载该包并将 dll 文件作为 "content" 包含到您的项目中,并将属性“Copy to Output Directory”的值设置为“Copy Always”。

您可以参考How to use Ghostscript for converting PDF to Image了解更多关于直接调用GhostScript dll的详细信息。

此外,我们可以期待下一个版本的 Ghostscript 包。