Search code examples
androidvisual-studioxamarinxamarin.formsxamarin.android

Where can I set build action to "AndroidResource"?


It all started when I wanted to customize the Notification icon of my program. The icon is located in drawable folder and I need pass it to SetSmallIcon function as integer type (resource id).

Inside my Xamarin.Android project I have file AboutResources.txt with the following hint:

In order to get the build system to recognize Android resources, set the build action to "AndroidResource". The native Android APIs do not operate directly with filenames, but instead operate on resource IDs. When you compile an Android application that uses resources, the build system will package the resources for distribution and generate a class called "Resource" that contains the tokens for each one of the resources included.

But I cann't understand, where I can set the build action. I didn't find anything like that in the options of Project.

May be I just have missed some button or checkmark?

PS:

Visual Studio 2017


Solution

  • Just right click on the icon file that you put into the drawables folder -> you ll be able to see the option saying “build action”