Forum Xamarin.iOS

How to regenerate a view controller's .designer.cs file?

LaurieHannonLaurieHannon USMember, University

I am working with a storyboard, and would like to regenerate the .designer.cs for a custom ViewController to reflect new custom classes I have created for the UITextFields since the custom ViewController was initially defined. I have already edited the storyboard to use the new custom UITextField class ("MyTextField"), but now the .designer.cs file is out of date, showing these Outlets as UITextFields instead of MyTextFields.

This is what I tried:
1) Removed the .designer.cs file from the project
2) Deleted the .designer.cs file and ios/obj folder from the disk.
3) Opened the custom ViewController class in Xamarin Studio.
4) Launched XCode with the storyboard.
5) Clicked on the controls in the custom ViewController, and turned on the Assistant Editor view.

“No Assistant Results” shows in XCode’s Assistant Editor, where I was expecting the custom ViewController.h file to be. What else should I be doing? How can I force Xamarin Studio to regenerate a .designer.cs file that is in sync with the current storyboard file?

Xamarin Studio Version: 4.0.12
Xamarin.iOS Version:
XCode Version: 4.6.3


  • LaurieHannonLaurieHannon USMember, University

    In case anyone else runs into this issue, this is what I ended up doing to update the generated .designer.cs file for a custom view controller in which I had customized the class of the Outlets, changing them from UITextField to MyTextField:

    1. Backed up MyViewController.cs.

    2. Deleted MyViewController.cs and MyViewController.designer.cs from the project and from disk.

    3. Deleted all bin and obj directories from disk.

    4. Launched Xamarin Studio and verified MyViewController did not appear in the project.

    5. Launched XCode on the storyboard file.

    6. Verified the storyboard was using MyViewController for the Custom Class for the view controller, and MyTextField as the Custom Class for the text fields.

    7. Saved and closed the storyboard.

    8. Switched to Xamarin Studio and opened the newly-generated MyViewController.cs.

    9. Relaunched XCode on the storyboard.

    10. I now had a MyViewController.h file in the Assistant Editor for the view controller. Ctrl-dragged each desired outlet into the .h file, being careful to keep the names of the outlets the same as I had used originally.

    11. Copied the archived MyViewController.cs from step 1 over the version that was generated in step 7.

    12. Ready to use the MyTextField Outlets as intended in MyViewController, because it was in sync with the storyboard and MyViewController.designer.cs.

    If anyone knows of a quicker or more effective way to do this, please post.

  • AndreaCurtoniAndreaCurtoni USMember

    Hi, so this is how it "works" for me in Xamarin 5.8.2 and how I worked around the problem.

    Create the problem:

    1. rm iosViewController.designer.cs
    2. Refresh project, iosViewController.designer.cs marked in red, project build fails

    Try to solve the problem:

    1. Rebuild the project
    2. Touch the .storyboard file
    3. Modify the layout and save the storyboard
      None of these solves the problem, sometimes they work, most of the times they don't.


    1. Select an item such as a TextField
    2. Change the name, for instance "helloText" => "helloTex", save the storyboard, change the name back
    3. Rebuild
      This always works for me... but is nonsense. :(
  • softlionsoftlion FRBeta ✭✭✭

    +1 Laurie. But the existing outlets were deleted...

  • 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
  • poseidonnhposeidonnh KRMember
    edited November 2016

    I found that, if you do:
    1. Open .xib file
    2. Change the VIEW AS option. For example, Generic -> iPhone, iPad...
    The .design.cs file will be updated automatically.

Sign In or Register to comment.