MonoDroid: XML Layout Not Created in Resource.Designer.cs

I’ve started diving into MonoDroid a little bit, and I was following the directions here to create a ListView. The first step is to create a layout for each of the ListView items, which I followed, but the Resource.Designer.cs file was not updating with my newly created layout.

While developing with Android in Eclipse, the resources are auto-generated by just creating the files in the layout directory, which, evidently, is not the case for MonoDroid in Visual Studio. After searching a bit, I found this BuildProcess page for MonoDroid. It explained that resource files need the Build Action property of AndroidResource in order for the Resource.Designer.cs file to be updated with the layout.

Not sure if it’s possible to change the default, but out of the box the Build Action for an xml file is Content.

To fix:

  1. Right-click the xml file in the Solution Explorer
  2. Click Properties
  3. Change Build Action to AndroidResource
Facebooktwitterreddit