Forum Xamarin.Android

'Resource' does not contain a definition for 'Xml'

Following the Android PreferenceFragmetCompat docs ( I added a folder to my Resources folder in my Xamarin.Android project. Then I added a new .xml file to that folder, called preferences.xml.

Here are the contents of that file:

xmlns:android="(correct schema, new to the forum)">
          android:summary="@string/pref_autosync_summary" />

Both strings are properly defined in the strings.xml file.

I went on to add a PreferenceFragmentCompat to my project, in which, in the overriden method OnCreatePreferences I added the following line:


The error states 'Resource' does not contain a definiton for 'Xml'..

I tried:

  • Cleaning and rebuilding my project
  • Restartng Visual Studio
  • Restarting my computer
  • Deleting the contents of both the bin and obj folders, cleaning and rebuilding
  • Changing the CustomTool property of the preferences.xml file to MSBuild:UpdateGeneratedFiles and rebuilding
  • Screaming with frustration

I am aware that this SO thread ( exists, and I tried all the solutions mentioned there. Nothing seems to help.

Thank you in advance for any help.

Also posted to StackOverflow here:

Best Answer


  • Tored_Tored_ Member
    I solved it, thanks for reminding me to check it here :)
Sign In or Register to comment.