How to remove a field from an Entity in the designer and update generated code properly? RRS feed

  • Question

  • How do I remove a COMPLETELY UNUSED field from an Entity using the designer without generating compile errors?  This is assuming there are NO references to the field anywhere in my code.

    I have deleted the field.

    There are no references to it anywhere in the code.

    I rebuild, restart VS.

    Now in the SCREEN code in the CLIENT project, every time there is a reference to the entity FROM WHICH the field was deleted, I get a 'cannot resolve symbol' compile error.

    A diff shows that Lightswitch has removed the entire entity reference from the screen metadata in Client.lsml.  And also deleted some custom controls from the screen!

    Why would it have done that?

    Monday, June 17, 2013 1:48 AM


  • I'll answer my own question: because the deleted field was referenced in a query (built in the designer)

    for the entity collection in the screen.   

    It would be good if Lightswitch warned about this rather than deleting the collection entirely and also the controls that referenced it.


    * Get the screen from source control from a point before LS changes Client.lsml

    * Try to build.  Now you will see more informative errors about the missing field.

    * Amend your screen to avoid referencing the field you deleted

    Monday, June 17, 2013 3:23 AM