Blend SDK Version mismatch…hell
Be aware of this possible hell when dealing with Blend behavior(s), typically people that delivers behaviors (e.g. via NuGet) tend to include in the package the System.Windows.Interactivity assembly in order to provide to the end user a consistent package.
Well…when dealing with Visual Studio 2012 and Blend 4 and Blend Preview for Visual Studio 2012 and the .Net Framework 4.5 installed on top of the .Net Framework 4.0 it quite easy to encounter a strange (and intermittent) behavior of the designer.
What happens is that the designer sometimes complains telling you that the XYZ behavior cannot be added to the behavior collection because is compiled with a different version of the Blend SDK…sometimes…and the funny thing is that the application compiles fine and runs fine :-P
The core of the problem is that Visual Studio 2012 adds the following xml namespace to reference the behaviors:
and Blend adds the following:
They both points to a version (that is the same version) of the System.Windows.Interactivity assembly…thus if the assembly is included in the package or referenced in the target application not using the original one Visual Studio complains…
The solution is fairly easy: do not include System.Windows.Interactivity assembly in the package, do not add System.Windows.Interactivity assembly to your private lib folder, instead install the Blend SDK (or the full Expression Blend if you have a license), reference the assembly from there and use the correct xml namespace.
Blend SDK(s) download links: