Using the NuGet Package

The typical way of adding the PSPDFKit SDK to your project is to install the PSPDFKit for Windows Visual Studio Extension (VSIX) provided in the SDK zip file and then add a reference to your project.

However, for some development environments, installing a systemwide SDK is undesirable or impractical — for example, when building your app in a CI environment.

For these types of situations, you can use the provided NuGet package instead of the VSIX.

Configure the NuGet Package Source

First you need to tell Visual Studio that your solution will be using a NuGet package source other than nuget.org. To do this, you need to save a file called nuget.config in the same directory as your solution file. It should contain the following XML. If the file already exists, add it to the packageSources entry:

Copy
1
2
3
4
5
6
<?xml version="1.0" encoding="utf-8"?>
<configuration>
   <packageSources>
       <add key="PSPDFKitSource" value="path\to\directoryContainingNupkg" />
   </packageSources>
</configuration>

The source name in this example, PSPDFKitSource, can be named however you like. The path must correctly refer to the location of the directory containing the PSPDFKitUWP.1.5.1.nupkg package. After you save this configuration file next to your solution file (e.g. AdvancedExample.sln), you need to close and reopen your solution for Visual Studio to read the NuGet configuration.

Adding to the Solution

Open your app’s solution, and in the Solution Explorer, right-click on References and click on the menu item Manage NuGet Packages... This will open the NuGet Package Manager for your solution.

On the right-hand side of the manager in the Package source drop-down window, choose the entry PSPDFKitSource (or whatever you decided to name it). You should then see the entry for PSPDFKitUWP by PSPDFKit GmbH.

On the right side, in the panel describing the package, click on the Install button to install the package.

Once that is complete, you will see a reference to the package in the Solution Explorer under References.

Note that after adding the reference to the package in this manner and then building your solution from the command line with msbuild, the switch /t:restore can be used to restore the package from the source.

Consult the Microsoft documentation for NuGet configuration for more information about what kind of sources you can specify.