Merging vcproj files - SCM's hell

前端 未结 8 1591
长发绾君心
长发绾君心 2020-12-13 04:23

Merging project/solution files is a well-known disaster among developers/SCM admins performing merges in their source control.

Take, for example, a common scenario:

相关标签:
8条回答
  • 2020-12-13 04:57

    You might want to consider associating your tool with a trigger within your SCM (like a re-commit hook for SVN), in order to enforce the re-ordering within those files.

    Then you would stand a chance to efficiently merging these elements together.

    0 讨论(0)
  • 2020-12-13 05:04

    I typically try to avoid putting automatically-generated files under SCM. Automatically-generated files should be generated from source files that a developer controls, and those can be put under SCM. If a particular tool stores data in an opaque and fragile format, this is the tool's problem.

    Regarding Visual Studio, although I think it has decent compilers, libraries, and a debugging environment, I believe that the files in generates (PRJ, SLN, RC) are highly problematic. Apart from the problems you mention, they also change a lot between different VS versions. For this reason, we write our own makefiles, and build the programs externally, using make. Furthermore, we split the resource files into parts for which we are forced to rely on VS, and those we can sanely handle with a normal editor. We generate many resource files automatically from high-level description, written in custom domain-specific languages. We thus minimize the impact of changes that are difficult to handle under SCM.

    0 讨论(0)
  • 2020-12-13 05:10

    Check installation options - make sure that all your colleagues have x64 compiler component installed(or all haven't)

    0 讨论(0)
  • 2020-12-13 05:10

    There is a google project named gyp that generates Visual Studio solutions and projects much like CMake. Part of that project are python tools to sort xml nodes and attributes of .sln and .vcproj files respectively: pretty_sln and pretty_vcproj. You can download them independently from http://gyp.googlecode.com/svn/trunk/tools/

    I only looked at pretty_vcproj so far, it also expands .vsprop files imported into the vcproj, probably to compare the exact content of two vcprojs. The resulting vcproj does not conform to the schema provided by Microsoft though, but it would probably work fine, or one could change it to only sort the "Configuration" and "Platform" nodes, leaving everything else intact. Not sure if it's worth the effort, as there seem to be other projects directed at normalizing vcprojs already...

    0 讨论(0)
  • 2020-12-13 05:13

    I've written a small Perl-script to merge solution files:
    http://blog.tedd.no/index.php/2011/01/06/merging-multiple-visual-studio-solution-sln-files-into-one/

    The script could be modified to suit your needs.

    0 讨论(0)
  • 2020-12-13 05:18

    Project: Merge is my tool for comparing and merging XML files. I originally wrote it because I was experiencing exactly this problem with Visual Studio project files.

    It correctly detects re-ordered elements and/or attributes within the XML file and will correctly resolve nearly all 'conflicts' automatically.

    0 讨论(0)
提交回复
热议问题