'Remove Header from DotPeek files

I am trying to diff two versions of an application via decompiling them with DotPeek and then running a compare between them. But each file adds a header like this to the top:

// Decompiled with JetBrains decompiler
// Type: Common.ODataList`1
// Assembly: Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 11D70360-276E-4C80-B7DB-EA9D9A52D841
// Assembly location: E:\src\Scratch\ShiptrackCompare\prodDlls\Common.dll

The MVID is different for each file, so my diffs always show a difference for each file.

Is there a way to get DotPeek to not add this header?



Solution 1:[1]

IMHO this is an XY-problem. What you really want is to ignore the MVID in the comparison.

Configure your difftool to ignore comments. E.g. in Winmerge, select the Prediffer to ignore comments.

Winmerge ignore comments

Solution 2:[2]

Instead of using dotPeek, you can use dnSpy. It will not emit such a header in decompiled code.

You might want to turn off "Show tokens, RVA and file offsets" in the options to improve comparison.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Thomas Weller
Solution 2 Thomas Weller