PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Mon May 27, 2024 9:35 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Wed May 31, 2023 1:36 pm 
Offline

Joined: Wed May 31, 2023 1:25 pm
Posts: 3
I'm trying to install either PDFsharp-WPF or PDFsharp-GDI version 6.0.0-preview-2. Visual Studio's package manager reports the following message when attempting to install either one:

NU1202: Package PDFsharp-WPF 6.0.0-preview-2 is not compatible with net6.0 (.NETCoreApp,Version=v6.0). Package PDFsharp-WPF 6.0.0-preview-2 supports: net6.0-windows7.0 (.NETCoreApp,Version=v6.0)

I have .NET 6 SDK 6.0.408, and am running Windows 10 Enterprise.

The NuGet package PDFshart 6.0.0-preview-2 installs without issue.


Top
 Profile  
Reply with quote  
PostPosted: Wed May 31, 2023 3:51 pm 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 928
Location: CCAA
The PDFsharp builds that depend on Windows components like WPF or GDI will only compile against net6.0-windows7.0.
They need Windows, but higher versions are no problem.
This is no issue, this is by design.

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
PostPosted: Wed May 31, 2023 4:07 pm 
Offline

Joined: Wed May 31, 2023 1:25 pm
Posts: 3
TH-Soft wrote:
The PDFsharp builds that depend on Windows components like WPF or GDI will only compile against net6.0-windows7.0.
They need Windows, but higher versions are no problem.
This is no issue, this is by design.


When I attempt to install of the NuGet package for PDFsharp-WPF 6.0.0-preview-2, I get the following message:

Package restore failed. Rolling back package changes for 'BillOfLading'.

Unfortunately, it's not more specific as to why it failed besides the initial compatibility message that was shown before package installation.

Here is the output from attempting to install the package via PowerShell:

Code:
PM> Install-Package PDFsharp-WPF -Version 6.0.0-preview-2
Restoring packages for C:\Users\brianfutrell\source\repos\BillOfLading\BillOfLading\BillOfLading.csproj...
Install-Package : NU1202: Package PDFsharp-WPF 6.0.0-preview-2 is not compatible with net6.0 (.NETCoreApp,Version=v6.0). Package PDFsharp-WPF 6.0.0-preview-2 supports: net6.0-windows7.0
(.NETCoreApp,Version=v6.0)
At line:1 char:1
+ Install-Package PDFsharp-WPF -Version 6.0.0-preview-2
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
 
Install-Package : Package restore failed. Rolling back package changes for 'BillOfLading'.
At line:1 char:1
+ Install-Package PDFsharp-WPF -Version 6.0.0-preview-2
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
 
Time Elapsed: 00:00:00.7761449


Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 01, 2023 8:05 am 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 928
Location: CCAA
brianfutrellA wrote:
Package restore failed. Rolling back package changes for 'BillOfLading'.

Unfortunately, it's not more specific as to why it failed besides the initial compatibility message that was shown before package installation.
The messages are very clear and very specific:

"Install-Package : NU1202: Package PDFsharp-WPF 6.0.0-preview-2 is not compatible with net6.0 (.NETCoreApp,Version=v6.0). Package PDFsharp-WPF 6.0.0-preview-2 supports: net6.0-windows7.0 (.NETCoreApp,Version=v6.0)"

Your project BillOfLading targets "net6.0", so this project can work everywhere: Linux, Mac, Android, you name it.
You want to add the package "PDFsharp-WPF" and the W in WPF stands for Windows.
WPF is not supported under Linux, Mac, Android, you name it. That is the simple truth.

The package that will work with BillOfLading is this one:
https://www.nuget.org/packages/PDFsharp/6.0.0-preview-2

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 01, 2023 1:03 pm 
Offline

Joined: Wed May 31, 2023 1:25 pm
Posts: 3
Thanks for your help - I think I found the problem.

Within the project's properties, there is a target OS. I have never had to change this before, but by default no OS is targeted.

Attachment:
BOL Properties.png
BOL Properties.png [ 17.26 KiB | Viewed 3337 times ]


Once the target OS is changed to Windows, the version can be specified. After doing that, I could add the PDFsharp-WPF package without issue.

What I found strange about this was I made a test ASP.NET Core project, used the PDFsharp core package and it worked fine. I didn't specify a target OS for this project and it had no issues generating PDFs. When I added the code I used in the test project to the BillOfLading project (ASP.NET Core Model-View-Controller) and added the same PDFsharp core package, errors were encountered when specifying fonts.


Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 01, 2023 1:17 pm 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 928
Location: CCAA
brianfutrellA wrote:
What I found strange about this was I made a test ASP.NET Core project, used the PDFsharp core package and it worked fine. I didn't specify a target OS for this project and it had no issues generating PDFs. When I added the code I used in the test project to the BillOfLading project (ASP.NET Core Model-View-Controller) and added the same PDFsharp core package, errors were encountered when specifying fonts.
The PDFsharp version that depends on Windows automatically searches all fonts installed under Windows.
The Core version relies on the fonts you supply in your implementation of the IFontResolver interface. Nothing strange, nothing mysterious.

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 76 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group