locked
Lightswitch Constantly Deletes Code RRS feed

  • Question

  • Hi there,

    I've searched quite extensively for an answer to why Visual Studio / Lightswitch is constantly deleting my code on a daily basis. It seems that every time I update the data source (even if it's a small change like an additional column), or sometimes just run the application, the following occurs:

    1. Screens are wrecked. Items from queries are removed from the screen and I have to readd them (on most screens, even if that data source wasn't changed at all).

    2. Query sort arguments are removed. Anything I was sorting by is no longer being sorted. In fact, Visual Studio throws an error because it's trying to compile a broken sort (where nothing is selected to sort by). I have to readd the sort argument.

    3. My project is straight-up corrupted. All files relating to my data source are deleted. I've had to start my project over completely already once, and I don't want to do that again. I have my project on source control now in the event that things get messy again.

    Regarding extensions, I have no third-party extensions that would contribute to the problem. I'm running a straight-out-of-the-box Visual Studio 2013 Update 2 IDE. Any insight on why this is happening would be fantastic. Thanks.

    Friday, July 25, 2014 9:26 PM

Answers

  • A common confusion I've seen in the past is that when new developers first use the "Update Data Source" command, they only tick tables that they have changed, thinking that these are the only ones they want to refresh/reimport.

    This is understandable but incorrect. LightSwitch is going to refresh every entity in your application. If you don't tick to include a table, it will be deleted.

    Note also that changing the name of a column in SQL Server is seen by LightSwitch as deleting a column and creating a new one. It does not look at the data types and column orders to guess that you've actually just renamed something.

    Deleting a column or a table will result in those things being removed from queries and screens because they no longer exist.


    Simon Jones
    If you found this post helpful, please "Vote as Helpful". If it actually answered your question, please remember to "Mark as Answer". This will help other people find answers to their problems more quickly.

    • Marked as answer by Angie Xu Friday, August 8, 2014 2:08 AM
    Monday, July 28, 2014 9:13 AM