Visual Studios 2015 NuGet Ghostscript 安装错误

3

我似乎无法解决这个安装gsdll32的错误。

我正在运行64位的Windows和Visual Studios 2015。 我唯一能想到的是,NuGet试图在64位版本的Visual Studios上安装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

有时候在新电脑上重新打开存储库时,我的NuGet引用会出现问题,我必须执行update-package Ghostscript -reinstall。这可能是在这里的情况,还是只是在一个新项目上? - Carter
ghostscript从未安装过。它在安装过程中失败了。 - Roger
1
如果您想安装Ghostscript,我建议您使用Windows安装程序,该程序可以从ghostscript.com网站(下载页面)获取。一旦安装完成,DLL文件将随之可用(以及其他所有内容)。请注意,Ghostscript的使用受AGPL许可证限制,该许可证适用于软件即服务的用途,以防您在商业上使用。我刚刚检查了NuGet包,并发现它不包括许可证,这是明显的AGPL违规行为。我将安排联系维护人员并讨论此事。 - KenS
1个回答

4
由于 gsdll32.dll 是本机 dll 而非受控 .NET 库,所以您无法在项目中安装它。 您可以下载该软件包并将 dll 文件作为 "content" 包含到您的项目中,并将属性 "Copy to Output Directory" 的值设置为 "Copy Always"。

有关直接调用 GhostScript dll 的更详细信息,请参阅如何使用 Ghostscript 将 PDF 转换为图像

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


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接