简体   繁体   中英

Xamarin: Resource.Designer.cs doesn't update when I make changes

I got a problem with my Resource.Designer.cs. I spent well over an hour on google trying to find a solution, but I can't find a fix for my problem. When I add a button or a text field in the Main.axml editor thing, it doesn't update the Resource.Designer.cs file. So when I write "var label = FindViewById(Resource.Id.textView1);" it shows a red line under the "textView1" because there is nothing about it in the Resource.Designer.cs file.

Even worse: When I open a blank file and name it as "App1" (the default it was) and add all the things to get the same as in this tutorial, it can't detect the Resource.Layout.Main, since it generates the names wrong. Screenshot of MainActivity.cs: http://puu.sh/tqsNr/8ac98a5b08.png Screenshot of Resource.Designer.cs: http://puu.sh/tqsOv/dd1de7328f.png This is because the namespace in MainActivity is "App1", and it generates the namespace name in Resource.Designer as "application".

How can I fix this? I have very limited time because I have to use this for a school project.

This happened to me, and I figured it was a Xamarin bug. But in this case, it was because I had left a --> in my strings.xml file after I had removed some comments. I saw the compile warning deep in the error list.

To fix it, try adding a new .axml file to project. Worked for me (you can delete the file after it works).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM