views:

59

answers:

2

I work in a development shop with about 20 other developers. It's really a chore to have to merge changes to a Designer.cs file or a .Resx file, when 50% of the changes just involved a change in ordering of the same code in two updates.

What do other development teams do to keep these files in order, such that when two people make changes, the changes can easily merge into the file without having to also reconcile properties that just got moved around in them?

There is CodeProject project out there that does a sort on the data before comparing them... and that would make it easier to merge the changes. But that's an additional step I'd like to automate better.

Has anyone come up with a way to incorporate the sort/diff/merge-into-current-structure process into an automated solution?

I haven't used TFS, so maybe they have figured this out. But I just thought I'd see if anyone has any tricks?

A: 

The codeproject app you mention can be executed as a prebuild step so you don't have to do anything manually, just a once-off setup.

If you split resx files up into smaller files (i.e avoid using a massive global string table), then you can minimise contention. As long as programmers try to keep their locks for short periods you can then use exclusive locks to guarantee only one user can make edits to any file at a time, and the whole merge issue can be eliminated - often this can be achieved without too much inconvenience as long as your working practices are efficient. Limiting changes to a file to a limited set of specific users can help (and can also improve the consistency of ui too)

The last option is to invest in a better merge tool, to minimise the difficulty of merging.

Whichever approach you choose, there is always a bit of compromise needed.

Jason Williams
We're just starting to deal with growing string tables; nothing horrible yet. But the biggest frustration comes when two developers make small UI changes to a tabbed control, a form with a few datagrids, or just a form that has a lot of controls. Sometimes it seems arbitrary why Visual Studio decides to reorder the objects when making a small change to the form.I do know that ordering matters occasionally, so I don't want to always sort the data alphabetically. I just wish there was a better tool than just a text-diff to determine changes in those files.
AmoebaMan17
@AmoebaMan: I agree - it's a poor situation. Even the most trivial edits often result in massive changes to unrelated parts of the XML. For complex forms the best I can suggest is to redesign the UI to make the forms simpler or split into separate dialogs (this may help end users as well if the forms are complex), use separate panels that are composited into a single form at runtime (so you can use several resx files), or just control access to avoid merges (exclusive locks or one "owner" who makes all needed changes to that form).
Jason Williams
A: 

My team uses a set of database tables and a couple of web pages to maintain the values, and to allow translations to be done.

We then have an export application, which generates the resx files using the ResXResourceWriter class and also generates the designer.cs files by calling the resgen.exe tool.

We all point our local copies of the export application to a common database, and we have our automated build server run the application in console mode to any builds always have the latest resources.

If you look at some of my recent questions, you'll see I've just recently resolved a few issues with that process.

Hopefully, that'll give you a few ideas. It's definitely worth spending the time to get this right. Especially from the sounds of your situation, a few days writing some support tools would be time well spent.

Antony Scott