Thursday, January 16, 2014

Invalid markup in XAML in Visual Studio 2013


If you get this error in designer when there’s clearly no error in your XAML:
- close all files open in Visual Studio
- close Visual Studio
- delete the .suo file near the .sln
- delete bin and obj folders

if still doesn't work you can try to delete all directories from:
%LocalAppData%\Microsoft\VisualStudio\12.0\Designer\ShadowCache

More info:
http://stackoverflow.com/questions/12871358/visual-studio-2012-xaml-designer-invalid-markup
http://forums.xamarin.com/discussion/10284/xamarin-new-pcls-w8-wp8-net45-xamarin-ios-xamarin-droid-plus-new-microsoft-bcl-terribly-broken

4 comments:

Gabriel said...

Dude!! Your a boss!!!!I was going nuts, search all over on the net. No Solution, my C# code had no errors, and XAML had none!

Andrei Nitescu said...

Thanks.
It's nice to see it's helpful to someone else too.

Twan said...

One solution I found was unloading the project and reloading it, just the project not the solution. Right click the project, choose 'unload project' and then right click the project again and choose 'load project' the designer came back to life.

For me I think it has something to do with being unable to reach the TFS server I use at work. Working offline throws these issues for me I guess.

Anonymous said...

Thank you Twan!
I tried the OP's suggestion, but I still couldn't get past the error.
Unloading and reloading the project worked perfectly though.