Migrating unit tests from v1 to v2

The xUnit.net team tried to ensure that migration of unit tests from v1 to v2 would be as painless as possible. Most of the migration tasks should be fairly straightforward and mechanical (replacing NuGet packages, doing simple search & replace, etc.).

Steps:

Update the xUnit.net binaries

Binaries for xUnit.net are now distributed exclusively through NuGet. Updating the binaries differs based on whether you originally used CodePlex or NuGet to acquire them. Please choose from one of the two options below.

If you installed xUnit.net v1 via CodePlex:

  1. You will need to manually remove any references to xunit.dll and/or xunit.extensions.dll.

  2. Then, add the new xunit NuGet package. Start by right clicking on the project in Solution Explorer, and then choosing the Manage NuGet Packages... menu item:

  3. Click on Browse in the upper left corner. In the search box on the upper right, type xunit. The search should yield results like this:

  4. Locate the xUnit.net entry, and click Install.

If you installed xUnit.net v1 via NuGet:

  1. Right click on the project in Solution Explorer, and then choose the Manage NuGet Packages... menu item:

  2. Click on Installed along the top. If you see xUnit.net: Extensions installed, please click the Uninstall button. (If NuGet offers to uninstall the xunit package for you, you should decline. You're going to upgrade that package in the next step.)

  3. Click on Updates along the top. Locate xUnit.net in the list of packages, and click Update:

Update the unit tests

Build your solution. If everything compiles, then you're done!

If it doesn't compile, here are some of the things that may need to upgraded by hand:

Copyright © .NET Foundation. Contributions welcomed at https://github.com/xunit/xunit/tree/gh-pages.