PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.com/

Issue installing prerelease versions of PDFsharp
http://forum.pdfsharp.com/viewtopic.php?f=2&t=4448
Page 1 of 1

Author:  brianfutrellA [ Wed May 31, 2023 1:36 pm ]
Post subject:  Issue installing prerelease versions of PDFsharp

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.

Author:  TH-Soft [ Wed May 31, 2023 3:51 pm ]
Post subject:  Re: Issue installing prerelease versions of PDFsharp

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.

Author:  brianfutrellA [ Wed May 31, 2023 4:07 pm ]
Post subject:  Re: Issue installing prerelease versions of PDFsharp

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

Author:  TH-Soft [ Thu Jun 01, 2023 8:05 am ]
Post subject:  Re: Issue installing prerelease versions of PDFsharp

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

Author:  brianfutrellA [ Thu Jun 01, 2023 1:03 pm ]
Post subject:  Re: Issue installing prerelease versions of PDFsharp

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 2934 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.

Author:  TH-Soft [ Thu Jun 01, 2023 1:17 pm ]
Post subject:  Re: Issue installing prerelease versions of PDFsharp

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.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/