Search code examples
visual-studio-2012xamarinmonomvvmcrossportable-class-library

VS2012 and INotifyPropertyChanged


I have that error porting my project from Xamarin Studio from Mac to VS2012 on Windows 7

Error 3 The type 'System.ComponentModel.INotifyPropertyChanged' is defined in an assembly that is not referenced. You must add a reference to assembly 'System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'. C:\Users\user\Documents\Visual Studio 2012\Projects\MyProject.Core\ApplicationObjects\AppStart.cs

This is my AppStart.cs:

using Cirrious.MvvmCross.ViewModels;
using MyProject.Core.ViewModels;

namespace MyProject.Core.ApplicationObjects
{
    public class AppStart
        : MvxNavigatingObject
          , IMvxAppStart
    {
        private readonly bool _showSplashScreen;

        public AppStart(bool showSplashScreen)
        {
            _showSplashScreen = showSplashScreen;
        }

        public void Start(object hint = null)
        {
            if (_showSplashScreen)
            {
                ShowViewModel<SplashScreenViewModel>();
            }
            else
            {
                ShowViewModel<HomeViewModel>();
            }
        }
    }
}

My Core project compile fine on Mac.


Solution

  • I'm guessing that you are building on the PC using Mac-built assemblies.

    PCL Assemblies built on the Mac using Xamarin Studio are not true Portable Class Libraries - instead they are normal assemblies built against the MonoTouch/Droid assemblies (which are traditionally closer to Silverlight than they are to proper .Net)

    The Binaries Repo on https://github.com/slodge/MvvmCross-Binaries/ provides both Mac and PC prebuilt assemblies to make it easier to switch between the two

    This situation is complicated right now because the support for PCLs from Xamarin is not here yet - but it is coming in the next 2 weeks.

    Further, if you are switching to PC for your development then there are many examples now available via http://mvvmcross.wordpress.com which show how all of your development can be done on the PC using Nuget