Some test text!

Search
Hamburger Icon

Windows / FAQ / "FileLoadException" or "FileNotFoundException" on .NET/WPF

"FileLoadException" or "FileNotFoundException" on .NET/WPF

Resolving FileLoadException due to missing VC redistributable

Starting with PDFNet 7.1 the VC++ 2013 runtimes are needed. Earlier versions of PDFNet use the VC++ 2010 runtime.

With versions of Visual Studio since 2008, Microsoft no longer allows statically linking to the CRT for .NET components. To get everything working, installing the VC++ runtime is not necessary, instead required DLLs can simply be copied into the same folder where PDFNet.DLL is located. There is no dll registration needed.

See this Microsoft guide on deployment options for the VC++ runtime redistributables.

If in doubt when using an older version, a utility called Dependency Walker can help you to identify which two DLLs are required.

"Could not load file or assembly 'PDFNet.dll'" when using PDFNet for .NET 4.x

This issue is most likely caused by missing VC++ Runtime redistributables, which can either be installed on the OS, or packaged with your app.

See above for links to correct VC++ runtime.

If there is some still some reason your require using .NET 2 assembly, the following article might help. http://stackoverflow.com/questions/3179028/mixed-mode-assembly-in-net-4

Unable to load DLL PDFNet.dll or one of its dependencies: A dynamic link library (DLL) initialization routine failed. (0x8007045A)"

This error generally means that GDI+ is missing/blocked by your OS, e.g. Windows Nano Server. PDFNet on Windows requires GDI+ for loading fonts, so to resolve this issue please upgrade to a server environment that allows access to GDI+.

For Azure Function the default settings block GDI+, but it is possible to reconfigure Azure Function to work. For example, one possible solution is to change the Function App hosting plan from "Serverless Consumption Plan" to the "App Service Plan" with a Basic server, for instance. Azure support should be able to assist you in getting GDI+. Or alterntively, switch to Linux based Azure Function.

Resolving 'FileNotFoundException: Could not load file or assembly 'PDFNet.dll' or one of its dependencies' [64-bit and .NET 4 specific]

If you are using a direct reference to PDFNet.dll, please ensure that your reference is pointing to the correct version 32-bit vs 64-bit of the PDFNet dll. Also check and ensure that copylocal is set to true for the assembly reference in the project.

Or see the guides above to make sure you have the required VC++ and GDI dependencies.

Get the answers you need: Chat with us