Saturday, January 3, 2015

XamlParseException on build after altering the XAML-file in Xamarin Studio

As usual, there is a long and a short version.

Short version

If you get a Xamarin.Forms.Xaml.XamlParseException each time you edit a Xaml file in a project open in Xamarin Studio then edit your project config file and remove any MSBuild:Compile references in it.

Long version

Since I usually carry on my Xamarin development using Visual Studio, I thought it would be a good idea to use Xamarin Studio every once in a while. So for my new shiny blog post I fired up Xamarin Studio and started hacking. The post was going to be about animating rows in a standard Xamarin Forms Grid.

Not long in to my hacking I regularly run into this issue every time I make any changes to my Xaml.
Break point at the XamlParseException
The exception being Xamarin.Forms.Xaml.XamlParseException.

It seems to go away every time I clean the entire solution.

So I do what all code monkeys do, I google (or Bing if you're a Microsoft employee reading this). This leads me to a registered bug from earlier this fall that seems to be the same issue. (2014-07-03)

Not fixed, this should be fixed. It's highly annoying! :)


The workaround is to remove the element for each xaml file in the project file. So each time you add a new Xaml-file you need to edit the project file. 

Removing the <Generator> element
Take care!

No comments:

Post a Comment