我在大约一个月前安装了GhostScript 9.19 x64,以便在.NET 4 Web应用程序中使用,从那时起它一直运行良好。
在最近的源代码控制签入(自安装GS之后的第一个)之后,我的GhostScriptAPI包装器现在抛出 BadImageFormatException
[DllImport("c:\\gsdll64.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
private static extern int gsapi_new_instance(out IntPtr lngGSInstance, IntPtr lngCallerHandle);
intReturn = gsapi_new_instance(out intGSInstanceHandle, callerHandle);
即使应用程序配置为定位"任何CPU" ,如果 x64 ,它将无法加载BadImageFormatException
明确设置,因此它实际上是针对 x86 。
我意识到我需要使用 x86 版本的GhostScript(gsdll32.dll)或让我的应用程序在 x64 上运行,但我的问题是 GhostScript如何预先在我的应用程序中工作,并且它针对两个不同的平台(运气,魔法,神圣干预)?