Designer.cs auto generated code naming convention causing source control conflicts

2 posts, 0 answers
  1. Anders
    Anders avatar
    1 posts
    Member since:
    Jun 2014

    Posted 18 Mar 2016 Link to this post


    My colleague and I have recently come across a problem with the way the designer generates code for Telerik controls. The problems happens when both of us are editing the same file at the same time, for instance one of us will use the designer to add some columns to a gridview while the other does the same to a completely different gridview. Everything works fine for each of our environments until it becomes time to check in our code to our TFS, where we run into conflicts of having duplicate names for objects. We noticed that every time one of us adds a column to a gridview using the designer, the auto generated code will name the column "gridViewTextBoxColumn123" where the number at the end is auto incremented from the previous column in our local designer.cs file. With both of us editing things at the same time, it repeats this process, and when we try to merge our code together, obvious conflicts arise where the only way to fix them is to either accept one version of the file and redo missing work, or to take both versions and then tediously go through the file renaming things.

    For the time being we have made a pact to check in any designer changes as soon as we make them, so the amount of re-work needed doesn't get too big, but I feel there should be a better way to handle our situation so these naming conflicts don't occur in the first place.

    Is there some setting we are missing to allow us to name the objects ourselves, or a better way to work around the problem?

  2. Dimitar
    Dimitar avatar
    2983 posts

    Posted 21 Mar 2016 Link to this post

    Hi Anders,

    Thank you for writing.

    There is now way to set the column object name at design time. Perhaps you can manually edit the Designer.cs file and change the names, however, it is not recommended to edit the auto-generated code. The best approach would be to edit the file one by one. If you are using the TFS you can check-out the file and prevent other users from editing it. Once you are done you can check-in the file and other users will be able to edit it. This way the TFS should be able to resolve any conflicts automatically.

    Please let me know if there is something else I can help you with. 
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top