Product Version: 10.2.0
While using the package PDFNet in the .Net 6.0 application getting exception as “Could not load file or assembly ‘PDFNet, Version=10.2.8.2358, Culture=neutral, PublicKeyToken=45663c462b939c60’. Format of the executable (.exe) or library (.dll) is invalid.”
Under the Packages getting below warning.
Package ‘PDFNet 10.2.0’ was restored using ‘.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8’ instead of the project target framework ‘net6.0’. This package may not be fully compatible with your project.
Note: The application has the target platform as AnyCPU
Can you tell me what version of the PDFNet SDK package you are installing with your project. It looks like you may be adding the PDFTron.NETFramework.x64 version, which is for .NET Framework applications only. The correct package for .NET Core applications can be found here.
Please find below details for my application.
TargetFramework: Dot Net 6.0
Target Platform: Any CPU
PDFTron SDK: PDFNet 10.2.0
Which version of the PDFNet SDK are you currently referencing in your application? We have a version specifically for the .NET Framework and one for .NET Core projects. From the error you are seeing It appears that you are referencing the .NET Framework version in your .NET Core application. You can either use this NuGet package for your .NET Core application or download it here.
Can you please provide the PDFNet version details which can be used for .NET Core application that can work in Target Platform: Any CPU?