Skip to content

Use PDFsharp with .NET Framework 4.6.2

Stefan Lange edited this page Jul 4, 2024 · 3 revisions

I cannot remember why we set the PDFsharp .NET Framework version to 4.7.2. Maybe because we use this version in one of our internal projects. However, PDFsharp works fine with .NET Framework 4.6.2 and starting with PDFsharp 6.2.0 preview 1 we will downgrade .NET Framework to this version.

If you stick with a project to .NET Framework 4.6.2 and cannot wait, do the following simple steps to change PDFsharp:

  • Clone the latest PDFsharp version 6.1.1 and open it in Visual Studio
  • Replace net472 with net462 in all *.csproj and *.nuspec files.
  • Add (or change) NET462 in the following files:
    CompilerServices.cs line 56
    FlateDecode.cs line 34
  • Rebuild the solution or type dotnet build in your terminal

Use the new NuGet packages with your project.

This procedure is only required for the PDFsharp GDI or WPF build. The Core build relies on .NET Standard 2.0 anyway.

Clone this wiki locally