Working with NuGet Packages

Modified on 2015/08/26 15:52 by Thomas Hövel — Categorized as: Articles, MigraDoc Articles, PDFsharp Articles

With PDFsharp 1.50 beta we have started to make preview versions of compiled assemblies available via NuGet before releasing the complete source code with samples etc.

With Visual Studio you can install the NuGet Package Manager to easily access NuGet packages. This work with VS 2012 Express and also with the Community Editions of VS 2013 and VS 2015. Just open Visual Studio and go to "Tools" => "Extensions and Updates..." to install the NuGet Package Manager if you do not have it yet.

To add PDFsharp or PDFsharp and MigraDoc to a project, right-click the project in the "Solution Explorer" and select "Manage NuGet Packages...". In the "Manage NuGet Packages..." dialog, open "Online" in the treeview on the left and select "". If you see a combobox showing "Stable Only" at the top, then open the list and select "Include Prerelease" to get beta/preview versions of PDFsharp and MigraDoc.
There is a search field in the top right corner of the dialog. Enter "pdfsharp" or "migradoc" to find our packages. Make sure the package shows "empira Software GmbH" behind the "Created by" label to get our core libraries. Searching for "pdfsharp" will also find some packages that use PDFsharp.

The NuGet Package Manager will download the package for you, install it, add reference to your project - and after a few seconds you are ready to use PDFsharp or MigraDoc.

Using the samples for PDFsharp and MigraDoc

The solutions that come with the samples for PDFsharp and MigraDoc already include references to the NuGet packages.

Open the sample solution in Visual Studio. Then go to the Solution Explorer, right-click the solution entry (the root element in the treeview) and select "Manage NuGet Packages for Solution...".
The NuGet Package Manager dialog should show an "Update" button at the top of the dialog. Click "Update" to download the missing packages.

Note:  We recommend not to use "Enable NuGet Package Restore" from the Solution Explorer.

See also:
NuGet Web Site