PDFNet.dll - Could not load file or assembly in VS 2022 on Windows 11 Enterprise

Product: PDFNet.dll

Product Version: 6.10.47.952

Please give a brief summary of your issue:
On Windows 11, using Visual Studio 22 (17.7.0)

When I run the Web Application, I received the following error:

Could not load file or assembly ‘PDFNet, Version=6.10.47.952, Culture=neutral, PublicKeyToken=45663c462b939c60’ or one of its dependencies. The system cannot find the file specified.

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

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

In Visual Studio, go to Tools → Options → Project and Solutions → Web Project:
Uncheck “Use the 64 bit version of the IIS Express for Web Sites and projects”

Exception Details: System.IO.FileNotFoundException: Could not load file or assembly ‘PDFNet.DLL’ or one of its dependencies. The specified module could not be found.

When the option is checked, I receive the following:

Exception Details: System.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.

In IIS, it does not matter if “Enable 32-bit” is set to true or false

In Visual Studio, all of the projects are build for “Any CPU”.

Now, here is the catch, in Windows 10, same version of Visual Studios 2022, when you uncheck “Use the 64 bit version of the IIS Express for Web Sites and projects”. Everything works prefectly.

What config adjustments are required to get this work in Windows 11? Does the PDFNet verison need to upgrade in order for it work in Windows 11?

Thank you

1 Like

Hi Crystal,

Please try updating to the latest version and see if the issue still persists. Version 6.10 is very old and it is likely that the old version is what is causing the issue.

Latest official: https://dev.apryse.com
Release channel: PDFTron Systems Inc. | Nightly
Developer channel: PDFTron Systems Inc. | Nightly
Latest official builds, and Release channel, are ready for production usage, however the developer channel builds do not get the same amount of testing and can be in a state of change.

2 Likes