繁体   English   中英

在32位进程下运行的GhostscriptLibraryNotInstalledException需要本机库

[英]GhostscriptLibraryNotInstalledException running under 32-bit process requires native library

在Visual Studio 2013中使用nuget,我在我的Windows x64 PC上将Ghostscript.NET安装到我的项目中。

为了确保我没有疯狂,我检查了一下:

PM> Install-Package Ghostscript.NET
'Ghostscript.NET 1.2.0' already installed.
Project already has a reference to 'Ghostscript.NET 1.2.0'.

PM> 

该项目由多个开发人员使用。 它针对任何CPU,并且需要保持这种状态。

这是我的代码:

public static void GhostscriptNetProcess(String fileName, String outputPath)
{
    var version = GhostscriptVersionInfo.GetLastInstalledVersion();
    var source = (fileName.IndexOf(' ') == -1) ? fileName : String.Format("\"{0}\"", fileName);
    var output_file = (outputPath.IndexOf(' ') == -1) ? outputPath : String.Format("\"{0}\"", outputPath);
    var gsArgs = new List<String>();
    gsArgs.Add("-q");
    gsArgs.Add("-dNOPAUSE");
    gsArgs.Add("-dNOPROMPT");
    gsArgs.Add("-sDEVICE=pdfwrite");
    gsArgs.Add(String.Format(@"-sOutputFile={0}", output_file));
    gsArgs.Add("-f");
    gsArgs.Add(source);
    var processor = new GhostscriptProcessor(version, false);
    processor.Process(gsArgs.ToArray());
}

每当我尝试调试应用程序时,都会收到以下错误消息:

GhostscriptLibraryNotInstalledException未处理

Ghostscript.NET.dll中出现未处理的“Ghostscript.NET.GhostscriptLibraryNotInstalledException”类型异常

附加信息:此托管库在32位进程下运行,需要在此计算机上安装32位Ghostscript本机库! 要下载正确的Ghostscript本机库,请访问: http//www.ghostscript.com/download/gsdnld.html

截图

查看Ghostscript.NET.GhostscriptLibraryNotInstalledException没有提供任何有用的信息,虽然CodeProject上的这篇文章表明调试器在32位模式下运行,而我安装了64位版本。

这一切都很好,但我怎么去测试我编写的使用Ghostscript的新代码?

如果使用MS Test进行测试,则必须设置运行测试的处理器体系结构,因为Ghostscript.Net会验证进程体系结构(Environment.Is64BitProcess)以在注册表中搜索ghostscript安装。

在菜单>测试>测试设置>默认处理器体系结构> X64中。

你真的安装了Ghostscript吗?

Ghostscript.NET只是Ghostscript的.NET接口,它在我看来就像消息:

“此托管库在32位进程下运行,需要在此计算机上安装32位Ghostscript本机库!要下载正确的Ghostscript本机库,请访问: http//www.ghostscript.com/download/gsdnld.html

试图告诉你,你没有安装32位版本的Ghostscript。 它甚至会告诉你去哪里下载副本。

你安装了Ghostscript吗? 你安装了32位版本的Ghostscript吗?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM