Xamarin.Forms Android Resource.Designer generating without layout xml

Nilas Kjærup 0 Reputation points
2024-10-22T11:54:19.0933333+00:00

Hello!

Running VS22 and Xamarin.Forms 4.8.0.1269

I've got an app in Xamarin.Forms used for Windows and Android.
We've recently had to rename the entire project and in doing so changing the name of all the namespaces and folders. I've triple checked and everything seems in place.
It runs in windows with no issues.

When trying to compile for android i get the following errors:
CS0117 'Resource.Layout' does not contain a definition for 'Tabbar'
CS0117 'Resource.Layout' does not contain a definition for 'Toolbar'

Checking the Resource.designer.cs, (the autogenerated android layout script) it sure doesn't contain a definition for it.
The folder containing the layout is in /Resources/layout/Tabbar.xml.
Checking the file from my previous Git, it does contain the Tabbar definition, so i'm not sure whats causing this. Ive renamed projects in the past, without running into this issue.

Ive tried:

  • Cleaning the project and rebuilding
  • Deleting the Resource.designer.cs file and regenerating it
  • Copied the definition from previous gitted resource designer
  • Renaming the xml files to lowercase (even though its never been lowercase)
  • Restarting Visual Studio

I really hope some genius knows why Android suddenly doesnt generate my resource.designer properly.

Thanks for reading!

-NK

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,362 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,225 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,054 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Nilas Kjærup 0 Reputation points
    2024-10-24T08:10:22.3466667+00:00

    I solved the issue!

    When changing the folders names etc, it had somehow changed the Build Action on the Tabbar and Toolbar to Content instead of AndroidResource. I dont why only those files were affected, but i'm just documenting in case another poor soul comes across the same issue.

    12312345123

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.