How can I setup a Xamarin Forms project that uses MvvmCross as the framework?

I'm running into trouble when I try to install MvvmCross.Forms on my Project.Core project. To give as much information as possible, I'll share a step by step guide to how I setup my project.

Step 1: Open VS2017 and click Create new project....
Step 2: Select Cross Platform App (Xamarin), Enter a name, and click OK.
Step 3: Select Blank App, Under UI Technology select Xamarin.Forms, Under Code Sharing Strategy select Portable Class Library (PCL), and click OK.
Step 4: A window pops up to select the target version for the UWP, select Target Version Windows 10 Creators Update (10.0; Build 15063), and Minimum Version Windows 10 November Update (10.0; Build 10586). Click OK.
Step 5: Right click Solution, select Manage NuGet Packages for Solution..., update all packages that have newer versions.
Step 6: On the Manage Packages for Solution page click Browse. In the search bar type MvvmCross.StarterPack. Install on all projects.
Step 7: In the search bar type MvvmCross.Forms. Install on all projects.

MvvmCross.Forms installs on Project.Android, Project.iOS, and Project.UWP. When installing on the Project.Core project the task fails with the following error message (Could not install package 'MvvmCross.Forms 5.1.1'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile259', but the package does not contain any assembly references or content files that are compatible with that framework.)

Any help is much Appreciated.

Answers

  • I've had the same problem. If you check the platform targets for your PCL you'll probably find they do not include windows 10 UWP. If so then you need to uninstall all the nugets from the PCL, adjust the target platforms to include UWP and then reinstall the nugets.

    I guess it's a bug in Microsoft's project template for xamarin forms.
  • You were correct, The Windows Universal 10.0 target was not checked. However, for some reason after I uninstalled all NuGet packages and checked Windows Universal 10.0 it did not change. I checked the box, clicked OK, and opened the change targets window again but Windows Universal 10.0 is unchecked. Any idea what's going on?

Sign In or Register to comment.