A fix for the design time error in MVVM Light V4.1

Blend, MVVM, Phone, Technical stuff, Windows Phone, Work
See comments

For those of you who installed V4.1 of MVVM Light and created a project for Windows Phone 8, you will have noticed an error showing up in the design surface (either in Visual Studio designer, or in Expression Blend). The error says: “Could not load type ‘System.ComponentModel.INotifyPropertyChanging’ from assembly ‘mscorlib.extensions’” with additional information about version numbers.

The error is caused by an incompatibility between versions of System.Windows.Interactivity. Because this assembly is strongly named, any version incompatibility is causing the kind of error shown here (for an interesting discussion on the strong naming issue, see this thread on Codeplex).

I managed to resolve the issue for Windows Phone 8 and will publish a cleaned up installer next week. In the mean time, in order to allow you to continue development, please follow the steps:

  • Download the new DLLs zip package (MVVMLight_V4_1_26.zip). 
  • Right click on the Zip file and select Properties from the context menu.
  • Press the “Unblock” button (if available) and then OK.
  • Right click again on the zip package and select “Extract all…”. Select a known location for the new DLLs.
  • Open the MVVM Light project with the design time error in Visual Studio 2012.
  • Open the References folder in the Solution Explorer.
  • Select the following DLLs: GalaSoft.MvvmLight.dll, GalaSoft.MvvmLight.Extras.dll, Microsoft.Practices.ServiceLocation.dll and System.Windows.Interactivity.dll.

  • Press “delete” and confirm to remove the DLLs from your project.
  • Right click on References and select Add Reference from the context menu.

  • Browse to the folder with the new DLLs.
  • Select the four new DLLs and press OK.
  • Rebuild your application, and open it again in Blend or in the Visual Studio designer.

The error should be gone now.

In the next few days, as time allows, I will publish a new MSI containing a fixed version of the DLLs as well as a few other improvements. This quick fix should however allow you to continue working on your Windows Phone 8 projects in design mode too.

Special note for WP7.1

Because of some issues with the WP7.1 version of the DLLs, I had to (hopefully temporarily) remove the INotifyPropertyChanging interface from the ObservableObject and ViewModelBase classes. I am talking with Microsoft to try and solve this issue. In the meantime, I hope that this change will not affect too many people.

Previous entry | Next blog entry

Comments for A fix for the design time error in MVVM Light V4.1