9

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...

webnator
  • 91
  • 1
  • 3
  • did you try to open the xib file in xcode? like double clicking it in xamarin studio? – aiapatag May 30 '13 at 09:45
  • I am having the same issue using Xamarin Studio 4.0.10 (build 5) on Mac. I tried deleting the Resource.designer.cs file but now it won't regenerate it. Did you ever find a solution? – Camputer Jul 25 '13 at 13:35

3 Answers3

6

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.

Has AlTaiar
  • 4,052
  • 2
  • 36
  • 37
5

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

cheezy
  • 446
  • 1
  • 5
  • 17
0

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