VISUAL STUDIO   Windows Mac

Installing NUnit 2.6.4 using NuGet

PDF for offline use
Related Links:

Let us know how you feel about this

Translation Quality


0/250

last updated: 2017-03

This guide covers how to downgrade NUnit 3.0 to NUnit 2.6.4 using NuGet.

Overview

Developers that are writing tests in Xamarin Studio or using Xamarin.UITest should be using NUnit 2.6.4 as NUnit 3.0 or higher is not compatible with Xamarin Studio or Xamarin.UITest. Attempting to run unit tests in Xamarin Studio or Xamarin.UITests with NUnit 3.0 will fail.

This guide will discuss how to install NUnit 2.6.4 using NuGet for Xamarin Studio. These steps will also uninstall NUnit 3.0 if necessary.

This guide will discuss how to downgrade NUnit 3.0 to NUnit 2.6.4 using NuGet in Visual Studio 2015.

Requirements

This guide assumes that there is an existing solution with a mobile app project and a test project.

Installing NUnit 2.6.4 in Xamarin Studio

The following steps describe how to install NUnit 2.6.4.

  1. Open the Package Manager - Right click on Packages and select Add Packages from the popup menu:

  2. Search for NUnit version:2.6.4 - Xamarin Studio will uninstall NUnit 3.0 (if necessary) and then download and install NUnit 2.6.4. In Add Packages dialog, enter the text nunit version:2.6.4 in the Search field located in the upper right hand corner. Select NUnit from the search results and click the Add Package button:

It is possible to confirm that NUnit 2.6.4 has been installed by inspecting the version number of the NUnit package in the Solution Pad:

Summary

This guide discussed how to downgrade NUnit 3.0 to NUnit 2.6.4 in Xamarin Studio using the Package Manager Console.

Installing NUnit 2.6.4 in Visual Studio

This section will focus on using the NuGet Package Manager Console in Visual Studio 2015 to uninstall NUnit 3.0 and install NUnit 2.6.4.

  1. Start the NuGet Package Manager Console - Select Tools > NuGet Package Manager > Package Manager Console:


  2. Verify The Version of NUnit - you may optionally verify the version of NUnit that is installed by running the command Get-Package -Project <UITEST PROJECT>:

[PM] Get-Package -Project [TEST PROJECT NAME]

        Id                                  Versions                                 ProjectName
        --                                  --------                                 -----------
    NUnit                               {3.0.1}                                  [TEST PROJECT NAME]
    Xamarin.UITest                      {1.2.0}                                  [TEST PROJECT NAME]

If you see NUnit 3.0 or higher, then you must downgrade to NUnit 2.6.4.

  1. Uninstall NUnit 3.0 - Use the Uninstall-Package commandlet to uninstall NUnit 3.0:

    <PM> Uninstall-Package NUnit -Project <TEST PROJECT NAME>
    Attempting to gather dependencies information for package 'NUnit.3.0.1' with respect to project '<TEST PROJECT NAME>', targeting '.NETFramework,Version=v4.5'
    Resolving actions to uninstall package 'NUnit.3.0.1'
    Resolved actions to uninstall package 'NUnit.3.0.1'
    Removed package 'NUnit.3.0.1' from 'packages.config'
    Successfully uninstalled 'NUnit.3.0.1' from <TEST PROJECT NAME>
  2. Install NUnit 2.6.4 - Install Nunit 2.6.4 with the Install-Package commandlet as demonstrated in the following snippet:

    <PM> Install-Package NUnit -Version 2.6.4 -Project <TEST PROJECT NAME>
    Attempting to gather dependencies information for package 'NUnit.2.6.4' with respect to project '<TEST PROJECT NAME>', targeting '.NETFramework,Version=v4.5'
    Attempting to resolve dependencies for package 'NUnit.2.6.4' with DependencyBehavior 'Lowest'
    Resolving actions to install package 'NUnit.2.6.4'
    Resolved actions to install package 'NUnit.2.6.4'
    Adding package 'NUnit.2.6.4' to folder 'Z:\Desktop\DowngradeNunit\packages'
    Added package 'NUnit.2.6.4' to folder 'Z:\Desktop\DowngradeNunit\packages'
    Added package 'NUnit.2.6.4' to 'packages.config'
    Successfully installed 'NUnit 2.6.4' to <TEST PROJECT NAME>

Summary

This guide discussed how to downgrade NUnit 3.0 to NUnit 2.6.4 in Visual Studio 2015 using the Package Manager Console.

Xamarin Workbook

If it's not already installed, install the Xamarin Workbooks app first. The workbook file should download automatically, but if it doesn't, just click to start the workbook download manually.