Visual Studio 2015 - Xamarin - Android - Getting “resource.id does not contain a definition for xxx” when I try to do anything in the .cs file

前端 未结 17 1479
后悔当初
后悔当初 2020-12-30 07:21

Adding Additional Activity .cs and Layout axml Using Visual Studio 2015.

I\'m very new to Xamarin and Android

17条回答
  •  孤城傲影
    2020-12-30 07:32

    I had to modify Build Action for my layout file and re set the original Build Action as it was previously set. This made my visual studio to regenerate the resource ids in Resource.designer.cs file.

    Step #1:
    Go to properties of the layout file that is missing its ids and click the Build Action DropDown.

    Step #2:
    Select something from the dropdown other than AndroidResource.

    Step #3:
    Reselect AndroidResource from that Build Action.

    Now, you will have your Resource.designer.cs file regenerated and it will have the reference ids to your controls in the layout file.

提交回复
热议问题