I suggest you ...

Organize project XML files to reduce 3-way merge conflicts

If the project XML file contents were simply ordered, for instance alphabetically like a default file system view, it would drastically reduce the number of merge conflicts that edits cause.

Currently we see items added at the same spot in the file (so there is SOME order happening) with no relation other than time, causing a merge conflict that's completely avoidable. If an order was applied, it would make most 3-way merges automatic and/or a lot less work.

607 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Nick CraverNick Craver shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    11 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • Fernando AurescoFernando Auresco commented  ·   ·  Flag as inappropriate

        I do work with TFS and I came to a point were is impossible to merge the solution files when working with my 5 person team. Most of the conflicts are because things added to the development branch csproj file are in different position than the main branch csproj file. Sorting alphabetically would really help here. I'll try to create an app to sort the csproj file myself. This is really a pain.

      • Stefan SieberStefan Sieber commented  ·   ·  Flag as inappropriate

        Maybe it would also be fine if Visual Studio would default to a different kind of project setup - why for god's sake is it necessary to list all the files of a project? Wouldn't it be better if you include all source files inside certain directories?

        That is how Eclipse handles it and until I switched to Visual Studio I couldn't even imagine that adding files to a project could cause merge conflicts. Visual Studio already supports using wildcards in the project files. All that would need to be done is adding support for it in the UI and probably also make it the default behaviour (adding whole directories instead of files).

      • Burton RodmanBurton Rodman commented  ·   ·  Flag as inappropriate

        +1M! Please apply this principal to all file types in Visual Studio system -- build templates being the WORST offender. I change 1 character in a build template and see 100s of lines changed in diffs. PLEASE FIX!

      • Tim FishTim Fish commented  ·   ·  Flag as inappropriate

        For resx files, I created a command line app which my diff too uses to pre-process the files before comparing them. It loads the xml, sorts everything alphabetically and fixes formatting and works very well for merging. Before that it was a nightmare.

      • SamCPPSamCPP commented  ·   ·  Flag as inappropriate

        "This applies to all project xml files, but in particular to SLN & RESX"

        Indeed. There really should be a base ordering to components in resx, XML in anything generated by VS. In a multi-developer environment, a designer change that scrambles the designer contents makes the designer very difficult to use. Wastes hours every single merge.

      • Jason WIlliamsJason WIlliams commented  ·   ·  Flag as inappropriate

        This applies to all project xml files, but in particular to SLN & RESX

        In Solution files the XML includes a count of the number of active projects. If two people add a project, the count should be incremented twice, but as each developer has incremented it independently text-based merges just see the same change from both devs and consider it merged. This results in the file becoming corrupted by the merge as the value is now one less than it should be. As the number is simply a count of how many entries there are in one XML subtree, which would be trivial to calculate during loading, it is not something that should need to be serialised at all.

        In resx files, simply loading and saving the resx completely re-orders the entire file meaning that they are impossible to merge - because of this we have to use exclusive checkouts on resx even when they only contain simple things like lists of user interface text messages.

      • Jason StangroomeJason Stangroome commented  ·   ·  Flag as inappropriate

        This should extend to all VS-generated files. Where the ordering of lines within the file (or part of the file) doesn't impact behaviour, a canonical order should always be used to improve the merging and differencing experiences.

      • Morgan SoleyMorgan Soley commented  ·   ·  Flag as inappropriate

        Thanks for posting this. One of those daily development annoyances that everyone takes for granted but really shouldn't have to be dealt with.

      Feedback and Knowledge Base