Build PDFsharp solutions
Version 6.1.0
In this article
This article describes step by step how to compile a PDFsharp Project solution.
Preparation
Install prerequisites
Install the software as described in the prerequisites article.
Get repositories
We recommend to download or clone both the PDFsharp and the PDFsharp.Samples repositories from GitHub.
git clone https://github.com/empira/PDFsharp.git
git clone https://github.com/empira/PDFsharp.Samples.git
We recommend to clone the repositories, because only git clone
gets the tags for the repository. We use git-version
for the management of semantic versioning and this tool uses the latest tag of the branch to calculate the current version. Unfortunately, git-version
crashes if you do not have the PDFsharp source code in a repository.
If you download a ZIP file from GitHub instead of cloning the repo, you run into this issue.
Note on using the ZIP file from GitHub
GitHub offers to download a ZIP file containing all files from the repository. After unzipping the archive, you have all the files needed to build PDFsharp. However, as the build process relies on GitVersion, you have to create a repository with at least one commit to make the build script work.
Here are instructions to create a repository with a commit, provided that the Git tool is installed:
git init
git config --local user.email "you@example.com"
git config --local user.name "Your Name"
git add .
git commit -m "Init"
After doing so, dotnet build
should be able to create the solution for you. Version number will then be 0.1.0.
To set a different version number, add a tag like shown here:
git tag v6.1.0
Get the assets
As described in download assets, download the assets for both repositories by executing the following PowerShell script in each root directory.
.\dev\download-assets.ps1
Build solutions
Under windows
Load PDFsharp.sln
or PDFsharp.Samples.sln
in Visual Studio and build it
-or-
run dotnet build
in the solution folder.
Both solutions should build without any warnings.
Under WSL 2 or Linux
We use Ubuntu 22.04 to test PDFsharp.
Run dotnet build
in the solution folder.
Both solutions should build without any warnings.