What NuGet Packages Should I Use?

xUnit.net ships with many NuGet packages. This guide helps you understand which NuGet packages you should use in your projects.

If you don't know where to start, try starting with a reference to xunit.

Version selector: Stable (NuGet) Pre-Release (NuGet) Latest CI (MyGet)
Active Packages
xunit

This is the package that will most typically be used by unit test authors. It brings in references to xunit.core (which contains the unit testing framework) and xunit.assert (which contains the class you use to write assertions).

Introduced: 1.7.0
Depends on: xunit.assert, xunit.core
xunit.abstractions

This package is an internal dependency of the test framework, the platform specific execution DLLs (xunit.execution.*.dll) and the runner utility libraries. It defines a stable set of interfaces that these components use to communicate with each other. As long as the interfaces do not change, each component can be modified without requiring any changes or rebuilds of the other components. This allows for a version independent runner API. You should never need to directly reference this package.

Introduced: 2.0.0
Depends on: None
xunit.assert

This package contains the xUnit.net assertion library (i.e., the Assert class).

This is a separate NuGet package, because some developers wish to use the xUnit.net framework and test runners, but with a different assertion library.

If you want to extend the Assert class, you should consider using the xunit.assert.source package instead.

Introduced: 2.0.0
Depends on: None
xunit.assert.source

This package contains the xUnit.net assertion library (i.e., the Assert class) in source form. The Assert class is a partial class, which allows developers to write additional methods available directly from Assert.

When you have multiple unit test libraries in your project, it is common practice to import this package into a "test utility" library where you write all your custom assertions, and then reference that "test utility" library from your unit test projects.

Introduced: 2.0.0
Depends on: None
xunit.core

This is the primary package that developers should use when writing unit tests. It brings in a reference to xunit.core.dll, which defines the test framework (FactAttribute, etc.). It also copies platform specific execution DLLs (xunit.execution.*.dll) to the project's output folder, which controls the discovery and execution of tests.

It does not add a reference to the execution DLLs. This is because some platforms require two different versions of the DLL - one to run the tests on the target platform, and another so that desktop based runners (for example, Visual Studio) can also discover the tests. A reference can be added to the exection DLL by adding the xunit.extensibility.execution package.

If you wish to use xunit.core.dll for extensibility purposes (for example, to write your own reusable theory data providers), you should reference xunit.extensibility.core directly instead, bypassing the copying of the execution DLLs.

Introduced: 2.0.0
Depends on: xunit.extensibility.core
xunit.extensibility.core

This package contains xunit.core.dll. It is intended to be used by developers who wish to reference this DLL for extensibility purposes, such as writing your own theory data provider.

This package is used by xunit.core. It differs in that it does not include or copy the platform specific execution DLLs (xunit.execution.*.dll).

Introduced: 2.0.0
Depends on: xunit.abstractions
xunit.extensibility.execution

This package contains the execution libraries for all supported platforms (xunit.execution.*.dll). It is intended to be used by developers who wish to reference this DLL for extensibility purposes, such as creating custom test discovery and execution.

It differs from the xunit.core package in that it adds a reference to the platform specific execution DLL, rather than simply copying to the project's output folder.

Introduced: 2.0.0
Depends on: xunit.extensibility.core
xunit.runner.console

This package contains the console test runner. This runner is capable of running Desktop .NET and PCL projects from xUnit.net v1 and v2.

Introduced: 2.0.0
Depends on: None
xunit.runner.dnx

This package contains code to run tests written for DNX applications (including ASP.NET 5 or later). The runner code contained in this package includes both the console runner (invoked with k test) as well as the Visual Studio runner (which supports VS2015 or later).

Introduced: 2.1.0
Depends on: xunit.runner.utility
xunit.runner.msbuild

This package contains the MSBuild test runner. This runner is capable of running Desktop .NET and PCL projects from xUnit.net v1 and v2. When added, it automatically references the xunit MSBuild target, which can be used in your project file.

Introduced: 2.0.0
Depends on: None
xunit.runner.utility

This package contains the runner utility libraries for all supported platforms (xunit.runner.utility.*.dll). It is intended to be used by developers who are writing their own test runners, and provides a version independent API for discovering and executing tests.

The libraries contained here are both backward and forward compatible for all v1 and v2 xUnit.net tests.

Introduced: 2.0.0
Depends on: xunit.abstractions
xunit.runner.visualstudio

This package contains libraries to enable developers to run their unit tests inside Visual Studio (any paid-for versions from 2012 or later, as well as Visual Studio Community 2013 or later).

It supports unit tests written for the following platforms: Desktop .NET 3.5 or later (xUnit.net v1), Desktop .NET 4.5 or later (xUnit.net v2), Modern Windows 8 or later (xUnit.net v2), and Windows Phone 8.1 Universal (xUnit.net v2), as well as PCL libraries targetting one or more of these platforms.

Introduced: 2.0.0
Depends on: None
Retired Packages
xunit.execution This package was renamed to xunit.extensibility.execution as of 2.0 RC1.
xunit.extensions

This package was part of xUnit.net v1.x, and is no longer shipped as part of xUnit.net. Some of the features of this package were integrated into the xUnit.net core platform, and others were moved to the xUnit.net samples project.

For more information, see upgrading xunit.extensions.

xunit.runner.aspnet This package was renamed to xunit.runner.dnx as of 2.1 Beta 2.
xunit.runner.visualstudio.win8

This functionality was rolled into xunit.runner.visualstudio.

xunit.runner.visualstudio.wpa81

This functionality was rolled into xunit.runner.visualstudio.

xunit.runners

This package was part of xUnit.net v1.x, and is no longer shipped as part of xUnit.net. It has been replaced with two new packages: xunit.runner.console and xunit.runner.msbuild.

Copyright © 2017 .NET Foundation. Contributions welcomed at https://github.com/xunit/xunit.github.io.