Resource.designer.cs NOT regenerating in Mono (Xamarin Studio)

喜夏-厌秋 提交于 2019-12-10 02:25:04

问题


I'm currently developing an app with Mono, I recently updated to Xamarin Studio 4.0.8, and was having problems with the design elements not being added to the solution.

I tried to edit manually the designer.cs, and later on I erased it, hoping the program will regenerate it again, with the layout changes.

I have tried:

  • Rebuilding it

  • Cleaning and rebuilding

  • Erasing the file through the file explorer

And it still doesn't regenerate properly, Xamarin creates the Resource.designer.cs but it's empty, and when compiling it returns this:

Error CS0103: The name 'Resource' doesn't exist in the current context (CS0103)

Help please...


回答1:


I had this happen a while back. If you right click on your XML file, and click properties. Make sure that the Build Action is set to "AndroidResource"

If I recall correctly that fixed it




回答2:


Lots of time having this issue. What i did:

  1. Remove "resources.designer.cs" using Xamarin (secondary button->remove).
  2. Go to command line (finder on Mac/Explorer on Windows) and delete manually the file (be sure you deleted it).
  3. Go to Xamarin, clean->build (this will regenerate the resoruces.designer.cs).
  4. As you remove the file from the project, you have to add it again. secondary button over project-> add Files->select Resources.designer.cs (tipically on /Resources folder).
  5. Make sure the "Build Action" of the Resource.designer.cs file is Compile (sometimes it takes a different build action by default).
  6. Clean and build.

At least it have worked most of the time.




回答3:


This work for me:

  1. Open your .designer.cs file and erase all class content, letting only the class declaration empty.
  2. open .xib file or storyboard that give you trouble with your .cs file.
  3. update Identify>Class property of the view that use that .designer.cs class removing, unfocus, focus and setting again the property value.
  4. save
  5. rebuild


来源:https://stackoverflow.com/questions/16795116/resource-designer-cs-not-regenerating-in-mono-xamarin-studio

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