MVVM Light and EventToCommand give invalid markup in VS2015

I was just about to start using VS2015 with an existing WPF project, including the MVVM Light toolkit, but found that the problem was with the WPF / Xaml designer.

The project includes several EventToCommand tags in the markup as follows:

<i:Interaction.Triggers> <i:EventTrigger EventName="Loaded"> <command:EventToCommand Command="{Binding LoadedCommand}"></command:EventToCommand> </i:EventTrigger> </i:Interaction.Triggers> 

When loading xaml files using the EventToCommand construct, the developer cannot load the file and reports "Invalid markup." The error list displays:

The "EventToCommand" type from the "GalaSoft.MvvmLight.Platform" assembly is built with an older version of the Blend SDK and is not supported in the Windows Presentation Framework 4 project.

The project is configured for the target .NET 4.5, and it works fine VS2013 without any changes. All this is very similar to the question Where can I find the Galasoft.MvvmLight.WPF45 assembly? , but the proposed solution there does not help at all in VS2015.

I tested this in a new project created from the MVVM Light template, but I get the same error with this new project. The MVVM Light version is MvvmLightLibs 5.2.0 from NuGet, I also tested the older version of MvvmLightLibs version v4.x.

+6
source share
2 answers

The problem may be due to the lack of registration of System.Windows.Interactivity.dll in the GAC. The following steps will help you avoid an invalid markup error.

  • Run the development team for VS2015 as administrator

  • Change the directory to the Blend SDK:
    cd C: \ Program Files (x86) \ Microsoft SDK \ Expression \ Blend \ .NETFramework \ v4.5 \ Libraries \

  • Register DLL:
    gacutil -i System.Windows.Interactivity.dll

Link: https://connect.microsoft.com/VisualStudio/feedback/details/755407/xaml-designer-will-not-display-when-using-blend-sdk-behaviors

+3
source

Use this version of System.Windows.Interactivity: http://www.microsoft.com/en-us/download/details.aspx?id=10801

You can also install through the NuGet Package Manager. Search for System.Windows.Interactivity.WPF

+1
source

All Articles