-
Notifications
You must be signed in to change notification settings - Fork 129
Use PDFsharp with .NET Framework 4.6.2
When we brought support for .NET Framework back to PDFsharp 6.0, we arbitrarily chose .NET Framework version 4.7.2. It was already six years old, had no end of support set at that time, and it was the framework we used in our projects before jumping to .NET 6. Now people asked for support of .NET 4.6.2. This version is still supported until Jan 12, 2027 and PDFsharp only required minimal changes to compile against .NET 4.6.2. 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, so it works with .NET 4.6.2 "out of the box".