14

Is there a good tool to compare specifically web.config files to find specifically which settings are different values and which file has settings that don't appear in both.

XML comparison should do the trick, or an XSLT might work. There must be a tool for web.config settings out there?

6
  • 2
    It looks like most people are missing the "specifically web.config" part of this question...
    – Ishmael
    Jan 27, 2009 at 19:43
  • it looks like you are missing that that fact is irrelevant to a file comparer
    – annakata
    Jan 27, 2009 at 21:48
  • 4
    I disagree with that, comparing two files that are in the same format, order, spacing etc work fine for code and other files most of the time. I have a web.config file that has been mangled over the years, and is VERY different in ordering and sections. What I need to see the difference in their function. Tried out araxis merge which is great software, but doesn't shows me all kinds of false negatives for missing assemblies simply because they are in a different order.
    – zimmer62
    Mar 11, 2010 at 19:45
  • Yes, exactly what zimmer62 said. IMO, any solution that says includes a caveat like, "if you format both your files" greatly lessens the usefulness of the tool for the purpose of comparing web.configs. I don't see any suitable solutions here. I do use diff, but it only does so much.
    – Itison
    May 5, 2014 at 19:27
  • 1
    General file comparers are dumb. They don't perform functional comparison. They perform line-by-line diffs, which are generally useless. Content-aware comparisons are much more useful. Two files such as a web config, can be functionally equivalent, while appearing completely different to a line-by-line comparer. Just because the file type is text-based, doesn't mean a line-by-line diff tool is useful for it.
    – Triynko
    Jan 31, 2019 at 4:48

7 Answers 7

13

https://github.com/CameronWills/FatAntelope This tool will compare two web.config files and generate a web.config transform from the difference.

Disclaimer: I wrote it... I wanted to compare two web.config files and generate a transform. But I couldn't find anything out to help much beyond standard text file diff tools (WinMerge etc) which dont work very well for XML. So I created one :)

4
  • 1
    This question was posted seven years ago, rules were different by then. As a matter of fact, the question is now closed - no new answers will be allowed. Preventing questions from being asked is impossible. If you have further inquiries, feel free to drop into chat.
    – Kyll
    Nov 8, 2015 at 9:48
  • Sounds awesome! I will surely try it. :) Jun 6, 2016 at 8:28
  • 4
    7 years old, but still relevant when you have to look after old systems with out-of-sync web.configs. I will try your solution and give you some points!
    – McGaz
    Oct 17, 2016 at 17:26
  • 1
    Very, very relevant. Switching cloud platforms, needing to coordinate web configs between source code and tenant-specific deployment directories... this tool is a TREASURE.
    – Triynko
    Jan 31, 2019 at 4:39
4

BeyondCompare amongst many other utils

4
  • BeyondCompare isNOT free.. as far as i know. isnt it?
    – M.N
    Dec 3, 2008 at 9:32
  • Nice tool though! I think Jeff Atwood has mentioned this on the SO Podcast. Dec 3, 2008 at 9:36
  • Well if it isn't free the licence expiry code is buggy :)
    – annakata
    Dec 3, 2008 at 9:39
  • who downvotes beyond compare?
    – annakata
    Jan 27, 2009 at 21:47
4

WinMerge will help you best if you format both your files... you can format in Visual Studio itself and then compare in WinMerge...

1

In my experience, Araxis merge is the best tool for comparing any documents:

http://www.araxis.com/merge/index.html

Use it myself at work.

0

Use diff

It will neatly point out the exact lines and text that is different.

Diff Utilities are available for windows as well. Download here.

1
  • 1
    Let's just say the config files aren't sorted in the same way, a diff tool won't show this as well as a bespoke web.config file difference tool might.
    – digiguru
    Dec 3, 2008 at 9:30
0

Use winmerge.

You should get used to version control, subversion and tortoisesvn are recommended, and ankhsvn provides svn access from Visual Studio.

0

Wikipedia has a comparison of file comparison tools. Take your pick :o)

1
  • yeah.. the word comparison is in that sentance too often! Dec 3, 2008 at 9:43

Not the answer you're looking for? Browse other questions tagged or ask your own question.