Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to install Cube.Native.Pdfium.Lite.117.0.593 in .NET Framework projects #37

Open
frleong opened this issue Oct 19, 2023 · 7 comments

Comments

@frleong
Copy link

frleong commented Oct 19, 2023

Hello,

When I tried to install via nuget, I got an error that it cannot be installed in .NET framework 4.8 project. Could it be fixed? Thanks!

Install-Package : Could not install package 'Cube.Native.Pdfium.Lite 117.0.5938'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.8', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

@clown
Copy link
Member

clown commented Oct 19, 2023

Cube.Native.Pdfium.Lite is a package for pdfium.dll (an unmanaged DLL), so it is independent of .NET Framework version. This error is often resolved by updating the version of NuGet itself, so please check.

@frleong
Copy link
Author

frleong commented Oct 19, 2023

Hi, I think I have already the latest version of NuGet (Package Manager Console Host Version 6.7.0.127). I only get this error for projects targeted for .Net Framework 4.8. If I create a new project that targets .Net 6.0, I get no errors when installing. Thanks!

@frleong
Copy link
Author

frleong commented Oct 19, 2023

Is there any metadata error in Nuget repository?

@clown
Copy link
Member

clown commented Oct 20, 2023

Thanks for your information. I will investigate the issue.

@clown
Copy link
Member

clown commented Nov 7, 2023

I tried several things but could not reproduce it here.
If you create the lib/net48 folder in the deployed NuGet package (cube.native.pdfium.lite/117.0.5938 folder) and put a dummy file in it, does that fix the error?

@frleong
Copy link
Author

frleong commented Nov 8, 2023

Thank you. I am not too sure how to put the lib/net48 folder in the Nuget package. I still can't install cube.native.pdfium.lite via NuGet Package Manager in Visual Studio 2022, when I create a new project that targets .NET framework 4.8. What I have done was to create a dummy .NET 6.0 project, install the package and copied back the contents to the .NET 4.8 framework.

@clown
Copy link
Member

clown commented Nov 10, 2023

I found the cause. This error seems to occur when using the old CSPROJ format.

We will fix the issue in the next release (cube.native.pdfium.lite 120.0), but to avoid the error, please try either of the following

1. Use the new CSPROJ format (recommended)

For example, after creating a .NET 6.0 target project using Visual Studio, open the *.csproj file in a text editor and rewrite the TargetFramework from net6.0-windows to net48. (you may want to add <LangVersion>latest</LangVersion> as well).

2. Add lib/net48 to the extracted NuGet package folder

By default, NuGet packages are deployed in the C:\Users\<YourName>\.nuget\packages folder. Go to the cube.native.pdfium.117.0.593 folder in it, create the lib/net48 folder, and also create a file of whatever you want. (e.g., hack.txt)

Note that if you continue to use the old CSPROJ format in this way, the build will complete successfully, but the unmanaged DLL (pdfium.dll) will not be copied automatically. Therefore, you will need to manually copy the dll from the runtimes/win-x64 or runtimes/win-x86 folder after the build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants