CS0117 - Xamarin not detecting 'Resources' folders and files

ぐ巨炮叔叔 提交于 2019-12-06 15:52:08

Ok so I figured out what the issue was. Previously when I had been coding I had initially placed the 'menu' folder in the wrong directory. I had done this by right clicking accidentally 'layout' and clicking 'Add/New Folder'.

The problem came when I then manually dragged and dropped the folder into the correct place. But it seems that Xamarin only recognises files and folders that are added via the right click option and the compiler then only saw the files in their original, incorrect location.

However simply deleting the files with right click/'Remove' does not solve the issue. Whilst the target file was removed from the Xamarin UI, it was not removed from the project directory on disk and as such a new file with the same name cannot be added. I had to navigate to the project folder and run rm -rf menu to remove it. Then go back to Xamarin and right click/Add/New Folder and New File.

Following that I cleaned the project and rebuilt and it worked like a charm.

This post on Xamarin forums tipped me off to what the issue was.

Xamarin Post

I had the same problem, but I created the folder and file with New Folder and New File.

My solution was to Clean the build and then Build All, before using Resource.Menu. Aflter the build all, everything worked fine.

I think an alternative to this is to delete the "bin" and "obj" folder from your project folder.

took me a while but i got it working this way:

If its a xamarin forms app, Change "Resource.Layout.Xxxx" => "Droid.Resource.Layout.Xxx"

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!