In our C# MVC project we are storing our localizable strings in .resx files. Every time we add a new string, Visual Studio puts it at the bottom of the file, which means that if two strings are added in different branches then we will get a merge conflict, because two different blocks of code are being added to the same place.
How can we reduce our merge conflicts? Sorting the strings alphabetically might help, but I can't see how to do this. Or maybe we could tell git to treat each <data>...</data>
tag as an independent block?
We're currently using git, but had the same problem with TFS/TFVC.
We have found the ResXManager Visual Studio extension that can sort ResX files on save.
In Visual Studio select Tools > Extensions and Updates. Click Online in the left panel and then search for "ResXManager" in the box in the top right and install it.
Once installed, choose Tools > ResXManager, go to the Configuration tab at the bottom and enable the "When saving a RESX file, sort the XML data nodes by the key".
There's also a button to "Sort all files now". Sorting the files will create lots of conflicts, so carefully choose a time in your release cycle to minimise these conflicts. All developers will need to have ResXManager installed, but the setting is applied to the solution so they will not need to change it themselves.
Update
We've been using this for nearly 3 years now and our problem is solved - we hardly ever get resx merge conflicts any more. Even if a developer without the plugin adds a string at the end of the file, a few days later someone else working on an unrelated ticket will end up saving the same file and it will be sorted alphabetically.