Jader Dias
Jader Dias

Reputation: 90603

Is there any way to check whether a code change altered the binary?

I presume that if the C# code is unchanged, the generated IL will be the same each build. The problem is that 2 EXE files generated from the same code don't have the same hash.

I would like to check whether a change in code style generates a different IL. How can I achieve that?

Upvotes: 3

Views: 608

Answers (3)

Fabio
Fabio

Reputation: 3120

There are some tools you can use to disassemble the EXE and compare their content. Look at this blog http://immitev.blogspot.com.br/2008/10/ways-to-compare-net-assemblies.html

[]'s

Upvotes: 1

D'Arcy Rittich
D'Arcy Rittich

Reputation: 171589

You can do this with ILSpy, an open-source .NET assembly browser and decompiler.

enter image description here

Upvotes: 1

asawyer
asawyer

Reputation: 17818

You are making a bad assumption. A rebuild without code change will deliver a different binary.

See:

https://stackoverflow.com/a/8927785/426894

Every time you run the compiler you should get a different output.

And

http://blogs.msdn.com/b/ericlippert/archive/2012/05/31/past-performance-is-no-guarantee-of-future-results.aspx

Is compiling the same C# program twice guaranteed to produce the same binary output?

No.

Upvotes: 4

Related Questions