HansC
HansC

Reputation: 23

reference to type INavigationService claims it is defined in Prism, but it could not be found

After updating to Xamarin.Forms 3.1. and Prism.Forms 7.1.0.279-pre, my NUnit project can't seem to find INavigationService. That beeing said; I can create a mocked object of INavigationService, but the failure hits when trying to inject it to the ViewModel.

"Reference to type 'INavigationService' claims it is defined in 'Prism', but it could not be found".

Because of this, we can not run any tests on viewmodels.

The PCL and NUnit projects are using the same versions of .Net, XF and Prism. I've also tried different versions, both pre and stable.

Can anyone point me to the correct direction here? The NUnit project worked out just fine until we updated the solution.

Upvotes: 2

Views: 704

Answers (2)

Tom Soderling
Tom Soderling

Reputation: 25

Following the above suggestion, I had to change the Prism.Core package reference in my unit test csproj file to point from net45 to netstandard 2.0

From this:

<HintPath>..\packages\Prism.Core.7.1.0.431\lib\net45\Prism.dll</HintPath>

To this:

<HintPath>..\packages\Prism.Core.7.1.0.431\lib\netstandard2.0\Prism.dll</HintPath>

My unit test project is a .NET Framework 4.7.1 NUnit project

Upvotes: 1

peternlek
peternlek

Reputation: 46

may be a bit late but I had the same issue. I found that my test project .csproj file was referencing the 'net45' version of Prism Core while all other Prism packages were referencing 'netstandard2.0' versions. All OK after manually editing and changing 'net45' to 'netstandard2.0'.

Upvotes: 3

Related Questions