Re: [PDFNet] Could not load file or assembly 'PDFNet.dll' ' when using PDFNet for .NET 4.x

Showing 1-1 of 1 messages
Re: [PDFNet] Could not load file or assembly 'PDFNet.dll' ' when using PDFNet for .NET 4.x Ryan 3/19/13 10:33 AM
The PDFNet x64 library is for targeting frameworks 2.0 - 3.5. Since your building .net 4 or 4.5, you should use PDFNet for .Net 4.


You can see the libraries and the frameworks they target at this link

If there is some reason to use the .Net 2 assembly, the following article might help.



On 19 March 2013 04:07, Mirko via PDFTron PDFNet SDK <pdfnet-sdk+noreply-APn2wQdrW-hy5N4_k_h4Bmds6YC5GKG_McMVsl3WnoRhn@googlegroups.com> wrote:
Hi, I'm trying to develop a sample, blank web application including the PDFNet x64 dll. So I create the app from the standard VS2012 web form template and run it. Then I try to add the PDFNet dll.
If I run the test web app on .NET 3.5 no problem. If I run it in .NET 4 or 4.5 I get this error:

----------------------------
Could not load file or assembly 'PDFNet' or one of its dependencies. An attempt was made to load a program with an incorrect format.

=== Pre-bind state information ===
LOG: User = IIS APPPOOL\.NET v4.5
LOG: DisplayName = PDFNet
 (Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: PDFNet | Domain ID: 5
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Sites/WebApplication2/WebApplication2/
LOG: Initial PrivatePath = C:\Sites\WebApplication2\WebApplication2\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Sites\WebApplication2\WebApplication2\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/90a438de/bb3b334f/PDFNet.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/90a438de/bb3b334f/PDFNet/PDFNet.DLL.
LOG: Attempting download of new URL file:///C:/Sites/WebApplication2/WebApplication2/bin/PDFNet.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.


Stack Trace:


[BadImageFormatException: Could not load file or assembly 'PDFNet' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
   System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +34
   System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152
   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +77
   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +16
   System.Reflection.Assembly.Load(String assemblyString) +28
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +38

[ConfigurationErrorsException: Could not load file or assembly 'PDFNet' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +752
   System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +218
   System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +130
   System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +170
   System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +91
   System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath) +258
   System.Web.Compilation.BuildManager.ExecutePreAppStart() +135
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +516

[HttpException (0x80004005): Could not load file or assembly 'PDFNet' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9873784
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18033
----------------------------

I have already searched a lot on the web and in this group, and I have already tried the solutions proposed for instance in

https://groups.google.com/forum/?fromgroups=#!newtopic/pdfnet-sdk/pdfnet-sdk/jXBDWdV0_NQ

or

https://groups.google.com/forum/?fromgroups=#!newtopic/pdfnet-sdk/pdfnet-sdk/OqVycSlOlB0

or others similar, but to no avail. I'm running a Windows 8 machine x64 with all versions of .NET up to 4.5 installed, and I DO have the Microsoft Visual C++ 2010 x64 Redistributable installed on my PC. I have also tried copying both the msvcr100.dll and msvcp100.dll to the output bin folder, but I still get this error. I then thought that maybe it was the fault of VS2012 development server which runs in x86 mode, so I have set up a website on IIS and run it from there on x64, but still the same result. I am a bit bereft, does anybody have any idea? Thanx.

--
You received this message because you are subscribed to the "PDFTron PDFNet SDK" group (http://www.pdftron.com/pdfnet/forum.html).
---
You received this message because you are subscribed to the Google Groups "PDFTron PDFNet SDK" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pdfnet-sdk+...@googlegroups.com.
To post to this group, send email to pdfne...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.





--
Best Regards,

Ryan Barr
Software Developer
PDFTron Systems, Inc.
Tel: 1-604-730-8989
Fax: 1-604-676-2477

CONFIDENTIALITY NOTICE: This message (and any attachment to it) is intended only for the use of the individual or entity to which it is addressed in the header, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. Any reproduction, distribution, modification or use of the contents of this message (and any attachment to it) by any individual or entity other than the intended recipient is prohibited. If you have received this communication in error, please notify us immediately and delete the original.