Visual Studios 2015 NuGet Ghostscript安装错误

时间:2017-09-13 21:14:11

标签: c# visual-studio-2015 nuget ghostscript

我似乎无法弄清楚如何解决gsdll32的安装错误

我正在运行64位Windows和视觉工作室2015.我唯一能想到的是nuget正试图在64位版本的可视工作室上安装32位dll。但我似乎无法与其他任何人确认此错误。我需要Ghostscript将PDF转换为网站上的JPG。如果您有Ghostscript的替代品,请告诉我。 Visual Studio安装了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

1 个答案:

答案 0 :(得分:2)

  

Visual Studios 2015 NuGet Ghostscript安装错误

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

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

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