Reputation: 73
I'm trying to install the NUnit package in my Xamarin Forms project and I'm getting this error:
Severity Code Description Project File Line Suppression State
Error Could not install package 'NUnit 3.9.0'. You are trying to install
this package into a project that targets
'.NETPortable,Version=v4.5,Profile=Profile111', but the package does not
contain any assembly references or content files that are compatible with
that framework. For more information, contact the package author. 0
I'm working with Visual Studio 2017 and Windows 10.
Does anyone have any experience with this issue? It seems strange that there could be errors like this with such a common package...
Thanks so much!
Upvotes: 1
Views: 240
Reputation: 47937
NUnit 3.9 does not contain any assemblies that are compatible with Portable Class Library (PCL) projects. It has a .NET Standard 1.3 assembly but .NETStandard version 1.3 is not compatible with any PCL profiles.
So your options are:
Upvotes: 2
Reputation: 22647
The Visual Studio adapter and the NUnit Console cannot run Xamarin based tests because they are both based on the full framework. You can however use the NUnit Xamarin runner to run on devices. See https://github.com/nunit/nunit.xamarin.
Personally, I find it much easier to just target .NET 4.5.x in your test project and reference the Xamarin PCL project that you are testing. That allows you to use the latest version of NUnit and run your tests in Visual Studio or on the command line. See Testing Xamarin Projects using NUnit for more information.
Upvotes: 0