bblanchon / pdfium-binaries

📰 Binary distribution of PDFium
789 stars 166 forks source link

Add header and lib files to NuGet packages #126

Closed sungaila closed 7 months ago

sungaila commented 7 months ago

NuGet packages can be consumed by both .NET and C++. And it is possible to create hybrid packages for both. Solves #125.

Workflow output for these changes: https://github.com/sungaila/pdfium-binaries/actions/runs/6258520023

sungaila commented 7 months ago

Hi @afaustas, could you please download these NuGet packages and test bblanchon.PDFium.Win32.0.0.0.nupkg and/or bblanchon.PDFiumV8.Win32.0.0.0.nupkg?

I've run some tests with a simple C++ hello world project on Visual Studio but a second opinion would be very appreciated!

Edit: Oops, I forgot the build artifacts are not public. Here is an other download link: https://github.com/bblanchon/pdfium-binaries/files/12684185/bblanchon.PDFium.Win32.0.0.0.zip https://github.com/bblanchon/pdfium-binaries/files/12684192/bblanchon.PDFiumV8.Win32.0.0.0.zip

afaustas commented 7 months ago

Hi @sungaila ,

I tested them by creating a very basic PDF viewer with Qt Widgets. Works great! Thank you a lot 🙂!

However, the initial problem was not only missing headers and .lib but I couldn't even install the package from the nuget.org repository to my C++ project. I had an error: "Could not install package 'bblanchon.PDFium.Win32 119.0.6015'. You are trying to install this package into a project that targets 'native,Version=v0.0', 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.".

Now I didn't have any problems installing these updated NuGets to a C++ project but I am a bit worried about the "Dependencies" field. It still says ".NETStandard,Version=v2.0". I guess maybe the package manager just does not check dependencies when I install the package from the local storage. pdfium-dep

sungaila commented 7 months ago

@afaustas Good catch, I've retested on my machine and suddenly nuget complains about 'native,Version=v0.0' as well.

It turns out that for a C++ project there must be either a dependency to native,Version=v0.0 or no dependencies at all.

But just adding <group targetFramework="native" /> will break .NET projects. So I also need to add <group targetFramework="netstandard1.0" /> to all nuspec files.

I commited a fix and will upload the new nuget packages when the GitHub workflow finishes: https://github.com/sungaila/pdfium-binaries/actions/runs/6266622525

sungaila commented 7 months ago

Now all NuGet packages are available for both .NET and C++. @afaustas could you please take a look? This PR should be ready to merge then.

https://github.com/bblanchon/pdfium-binaries/files/12698295/bblanchon.PDFium.Win32.0.0.0.1.zip https://github.com/bblanchon/pdfium-binaries/files/12698297/bblanchon.PDFiumV8.Win32.0.0.0.1.zip

afaustas commented 7 months ago

@sungaila I checked. They work fine. Thank you a lot 🙂 !

bblanchon commented 7 months ago

@sungaila, I squashed and merged your branch. Thanks a lot!