We are trying to use WebSupergoo's ABCpdf .NET v10. And it works great if we use their installer. But v8 is already installed on the server with other projects using it, so we do not want to run the installer at this time. (Hopefully in the near future we can test the install on a different machine and/or upgrade those projects, but this project cannot wait on that.)
The "Manual Install" instructions from WebSupergoo (http://www.websupergoo.com/helppdfnet/default.htm?page=source%2F3-concepts%2F6-installation.htm) indicate to place the 3 main DLLs (ABCpdf.dll, ABCpdf10-32.dll, and ABCpdf10-64.dll) into the bin folder and add a reference to ABCpdf.dll.
We don't really want them in the bin folder, because Source Control is set to not add anything from that folder. However, to get it working (for now) they were placed in that folder. Then when I attempt to run the project, I get the following error (folder names changed for security):
System.BadImageFormatException was unhandled by user code
HResult=-2146234344
Message=Could not load file or assembly 'file:///D:\\Projects\Solution\WebProject\bin\ABCpdf10-32.dll' or one of its dependencies. The module was expected to contain an assembly manifest.
Source=mscorlib
FileName=file:///D:\Projects\Solution\WebProject\bin\ABCpdf10-32.dll
FusionLog==== Pre-bind state information ===
LOG: Where-ref bind. Location = D:\Projects\Solution\WebProject\bin\ABCpdf10-32.dll
LOG: Appbase = file:///D:/Projects/Solution/WebProject/
LOG: Initial PrivatePath = D:\Projects\Solution\WebProject\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
LOG: Using application configuration file: D:\\Projects\Solution\WebProject\web.config
LOG: Using host configuration file: D:\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Attempting download of new URL file:///D:/Projects/Solution/WebProject/bin/ABCpdf10-32.dll.
ERR: Failed to complete setup of assembly (hr = 0x80131018). Probing terminated.
StackTrace:
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
at System.Reflection.Assembly.LoadFrom(String assemblyFile)
at WebActivator.PreApplicationStartCode.Start() in D:\Code\Bitbucket\WebActivator\WebActivator\PreApplicationStartCode.cs:line 11
InnerException:
Our prefered method would be to have them in a "lib" folder (currently at the Solution level). So, I put the 3 DLLs in that folder and added the reference. The project compiles and runs, but when we attempt to create the PDF we get the following error:
Unable to load DLL 'ABCpdf10-32.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
WebSupergoo support says: "ABCpdf10-32.dll is not an assembly so of course it does not contain an assembly manifest".
I tried taking ABCpdf10-32.dll out of the bin folder, and I get the same error with ABCpdf10-64.dll.
I tried setting "Copy Local" on reference to False. No change.
Copy Local: https://msdn.microsoft.com/en-us/library/t1zz5y8c(v=vs.90).aspx
I tried using the "Probing" technique. I tried it in both the web.config & app.config file for the Project (there doesn't appear to be one for the Solution). I also tried moving the lib folder to within the project itself. No change.
Probing: https://msdn.microsoft.com/en-us/library/823z9h8w(v=vs.110).aspx
I'm not sure what else to try at this point. Any help would be greatly appreciated!
System.BadImageFormatException its a general exception, that use to occur when you are using a 32 bits DLL on a 64 bit enviroment, or viceversa.
Web apps: they use to load all the dlls on the folder, used or not (WebActivator.PreApplicationStartCode.Start()). Check the IIS pool, it's 64 bit? Then delete all the 32 dll on the folder or subfolders. Are you forcing it to 32? Then delete all the 64 dll on the folder or subfolders.
User contributions licensed under CC BY-SA 3.0