Prerequisites
Version 6.1.0
In this article
This article describes the tools needed to use PDFsharp or MigraDoc.
Use NuGet packages only
If you only want to use the PDFsharp Project NuGet packages in order to use PDFsharp Library or MigraDoc Foundation in your project, nothing special has to be installed. You can compile your project using e.g. dotnet build
.
To use the NuGet packages, you can use any development environment that can handle NuGet packages and targets a suitable framework like .NET 6.0 or .NET Framework 4.6.2.
We are using Visual Studio 2022. The Community edition is sufficient to build apps using the NuGet packages.
Compiling the source code
To compile the PDFsharp source code form a GitHub repository you have to install the following software.
Important
To compile and run the source code, you have to download the assets before compiling the solution.
Installation under Windows
All PDFsharp projects target either .NET 6 and also .NET Framework 4.7.2 or .NET Standard 2.0 respectively. But the source code uses selected C# features up to C#12. Therefore, it is necessary to always install the latest SDK to flawlessly compile the source code.
Development environment
If you want to use Visual Studio, we recommend installing the latest version of Visual Studio 2022. The community edition should be sufficient. Include the following SDKs before starting the installation process:
- .NET Framework 4.8 SDK (recommended) or at least .NET Framework 4.7.2 SDK
- .NET 6.0 SDK
- .NET 8.0 SDK
If you do not install Visual Studio, manually install the SDKs listed above.
PDFsharp can be compiled without Visual Studio by calling dotnet build
.
PDFsharp runs on .NET 6.0 or higher. However, we use newer C# features which do not depend on the framework. Therefore the latest version of Visual Studio should be used.
Some special sample repositories, like PDFsharp.MAUI
or PDFsharp.Blazor
may require
the latest SDKs.
PowerShell
Install PowerShell 7.
Git
Install git if needed.
Installation under WSL2 or Linux
We at empira use Ubuntu 22.04 for testing PDFsharp. We tested it in WSL2 and in a VM.
Development environment
We recommend Visual Studio Code for development. For WSL2 install it under Windows with WSL extension. Also install the following SDKs:
- .NET 6.0 SDK
- .NET 8.0 SDK
We recommend to use the Microsoft redistribution. E.g. we use the SDKs for Ubuntu 22.04.
After the installation, try dotnet build
for the PDFsharp
and/or the PDFsharp.Samples
repository. Both should compile without any warnings.
Because the solutions contain projects that cannot be executed under Linux, like WPF example projects, these projects contain the following entry:
<EnableWindowsTargeting>true</EnableWindowsTargeting>
So they are compiled under Linux, but according to Microsoft may not run properly under Windows. You should compile all Windows-only projects under Windows only if you want to use the binaries under Windows.
PowerShell
Install PowerShell 7 for Linux.
Git
Install git if needed. Git is required to build the PDFsharp library using the original solution file.
See also Build PDFsharp · Upgrade existing projects to PDFsharp 6