GhostscriptLibraryNotInstalledException running under 32-bit process requires native library

旧城冷巷雨未停 提交于 2019-12-10 14:07:29

问题


Using nuget in Visual Studio 2013, I installed Ghostscript.NET into my project on my Windows x64 PC.

Just to make sure I wasn't crazy, I checked it:

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

PM> 

The project is used by multiple developers. It targets Any CPU, and needs to remain that way.

Here is my code:

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());
}

Whenever I attempt to debug the application, I get the following error message:

GhostscriptLibraryNotInstalledException was unhandled

An unhandled exception of type 'Ghostscript.NET.GhostscriptLibraryNotInstalledException' occurred in Ghostscript.NET.dll

Additional information: This managed library is running under 32-bit process and requires 32-bit Ghostscript native library installation on this machine! To download proper Ghostscript native library please visit: http://www.ghostscript.com/download/gsdnld.html

Looking up the Ghostscript.NET.GhostscriptLibraryNotInstalledException did not provide any useful information, though this post on CodeProject indicated that the debugger is running in 32-bit mode whereas I have the 64-bit version installed.

That's all well and good know, but how do I go about testing the new code I wrote that uses Ghostscript?


回答1:


Have you actually installed Ghostscript ?

Ghostscript.NET is merely a .NET interface to Ghostscript, it looks to me like the message:

"This managed library is running under 32-bit process and requires 32-bit Ghostscript native library installation on this machine! To download proper Ghostscript native library please visit: http://www.ghostscript.com/download/gsdnld.html"

is trying to tell you that you don;t have a 32-bit version of Ghostscript installed. It even tells you where to go to download a copy.

So have you installed Ghostscript ? Have you installed the 32-bit version of Ghostscript ?




回答2:


If you are testing with MS Test you have to set the processor architecture in which the tests are run, because Ghostscript.Net verifies the process architecture (Environment.Is64BitProcess) to search for the ghostscript installation in the registry.

In Menu > Test > Test Settings > Default Processor Architecture > X64.



来源:https://stackoverflow.com/questions/34454108/ghostscriptlibrarynotinstalledexception-running-under-32-bit-process-requires-na

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!