This is a migrated thread and some comments may be shown as answers.

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

1 Answer 114 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Anders
Top achievements
Rank 1
Anders asked on 19 Mar 2016, 12:03 AM

Hello,

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?

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 21 Mar 2016, 12:21 PM
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. 
 
Regards,
Dimitar
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
General Discussions
Asked by
Anders
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or