Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

[A]Type cannot be cast to [B]Type of matching assembly versions

Just recently I started getting this weird error, it's only problem in Designer, the app runs with no problems.

I've tried

  • clearing the shadow cache
  • removing bin/obj folder
  • rebuilding solution
  • removing and re-adding the mentioned assembly and doing all above again

This is the complete error

[A]MahApps.Metro.Controls.MetroAnimatedSingleRowTabControl cannot be cast to 
[B]MahApps.Metro.Controls.MetroAnimatedSingleRowTabControl. 
Type A originates from 'MahApps.Metro, Version=1.1.3.174, Culture=neutral, PublicKeyToken=null' in the context 'LoadFrom' at location 'C:\Users\usr\AppData\Local\Microsoft\VisualStudio\14.0\Designer\ShadowCache\x2tfp5zd.b23\jgke2cb5.0ws\tmp\MahApps.Metro.dll'.
Type B originates from 'MahApps.Metro, Version=1.1.3.174, Culture=neutral, PublicKeyToken=null' in the context 'LoadNeither' at location 'C:\Users\usr\AppData\Local\Microsoft\VisualStudio\14.0\Designer\ShadowCache\majxo3bg.w3c\dwou5m4n.p1u\MahApps.Metro.dll'.
HeRgoT  C:\Users\usr\MyProject\MyProject\MainWindow.xaml

Any idea what the cause is?

like image 898
pikausp Avatar asked Oct 10 '15 22:10

pikausp


1 Answers

I've encountered the same problem this was caused by multiple copies of mahapps.metro.dll in shadow cache folder and to fix this what I did was: 1. Uninstall mahapps.metro.dll as reference to the project 2. Close Visual Studio 3. Clear Shadow cache folder, then restart VS.

like image 174
akira1208 Avatar answered Nov 08 '22 07:11

akira1208