Jump to content

XML based merge for csproj Visual Studio project files


Recommended Posts

Hi there,


We're receiving a number of requests from people interested on having a better merge for Visual Studio projects, asking to support XML based SemanticMerge with special csproj capabilities. It is also extended to better support for XAML file merging.


If you take a look at our UserVoice you'll find:


* Support for XML files.


* Merge project files.


* XAML support.


We're also aware of issues merging resx files and I'll cover this topic below.


People also asked to merge .sln files but this enters into a different topic since .sln files are not XML based but they've their own syntax.


In order to better understand what to implement we'd like to open a thread and ask our users for feedback.


General XML merge


We have one question here: there are very good XML diff and merge tools like Altova's DiffDog. Do you think we can really provide any value with an XML specific merge tool when tools like Altova's are good enough in this field.


We'd like to hear about possible improvements that you think are missing and we could implement in our own tool.


ResX file merge


Merging resx files has always been a pain. Visual Studio tends to rearrange the entire file for no apparent reason and then merging becomes a nightmare. (I think old Delphi 3 with text .dfm did a better job 15 years ago).


In fact this is something we've experienced ourselves and we solved this long ago by introducing a small tool called sortresx.


Sortresx reads a resx file and sorts them by key. Then merging becomes much easier since there are not artificial "moves".


We never published sortresx but we're open to do that. So please let us know if you need it.


.csproj merge


Here comes the main topic for this thread. Do you have big issues merging .csproj files? If you do, we're open to implement support for csproj files in SemanticMerge, but we need to better understand your particular cases. If you can send us scenarios of the issues you have, comments and impressions, it would be great.


BTW, the solution could be as powerful as some sort of semantic csproj merge, or as easy (and maybe as effective) as sorting the keys within the file.


So please, send us your cases, comments and we will try to find a good solution.




Link to comment
Share on other sites

We’re adopting the ‘a branch per task’ scenario as much as we can. The problems begin when having to do database changes:

Thanks to the Entity Framework, the database is described in code in a .edmx file (your basic XML layout). Sadly enough, it doesn’t keep the order of the lines intact, so programmer A will have Entity XYZ at line 1 and programmer B will have Entity ABC on line 1.


This makes merging quite difficult, since it’s a massive file (we are trying to split it into a couple smaller files, but it’ll still stay quite big at around 5K lines). So when you’re having conflicts, you have to find the correlating Entity somewhere in the file, with Plastic not always finding them or marking them correctly. You end up with a removed line too much (or you forgot to include some field) and the whole .edmx crashes and you can start again – it’s mostly a really dumb thing you overlooked…

Merging early limits the problem, but isn’t always feasible, ex: when you have 2 branches of experimental code that are both OKed and you end up with quite a bit of database changes.


It’s doable after a while when you are used to it (as in, you can merge in one go), but it takes us at average 3 hours or more to merge this one file, while all the rest goes automatically without any issue.


I'm wondering in how far your Sortresx can be used to merge these files, since sorting them beforehand would lessen the problem.

Link to comment
Share on other sites

Well, we haven't tested sortresx with really BIG files, so I really don't know how could it perform, but we'll try to release the code this fortnight along with a blogpost explaining how to configure it and hopefully it will help you a lot, at least automating that manual merge task :)

Link to comment
Share on other sites

  • 2 weeks later...

One thing, that should probably be a permanent feature, would be to allow a way to identify some file types that should just quickly bail and use the text merge.


I'd love to use SemanticMerge as my primary merge tool, and let it bail out for stuff it doesn't understand. 


I know it does now, but it takes    so      long    ....

Link to comment
Share on other sites

SortResX is now released, look here to get more information about how to use it.


brendanjerwin: it's possible to configure in the GUI preferences of Plastic SCM the tools you want to use with each file extension; thus you could configure mergetool for your customized file extensions. Take a look at the documentation. Take into account that SemanticMerge only supports C#, VB .NET and Java. On the other hand, you can change how Plastic SCM manages files (binary, text) by right clicking on them in the Items view or Pending changes view. I hope this answers your question.

Link to comment
Share on other sites

  • 3 months later...


This topic is now archived and is closed to further replies.

  • Create New...