5

While using the ildasm.exe tool for disassembling other .Net applications, I came across the following line.

program.exe has not valid CLR Header and cannot be disassembled

But when I tried to disassemble my code, it didn't show any error, and disassembled the code easily.

As a result I am curious about what is a CLR Header and what can be the advantages/disadvantages of having a valid CLR Header for your assembly?

Can anybody please answer the above questions?

I checked the msdn, but couldn't find much information on the topic.

Pratik Singhal
  • 6,283
  • 10
  • 55
  • 97

1 Answers1

8

ILDASM.exe is meant to disassemble CLR code. If there is not a valid CLR header, it usually means that the executable was written in another language and compiled natively.

Justin Niessner
  • 242,243
  • 40
  • 408
  • 536
  • So, is there any way to protect my .Net app from being disassembled. – Pratik Singhal Jan 21 '14 at 19:15
  • 3
    There is no way to prevent any program from being disassembled. You can only make it harder to figure out what the disassembled code is doing by using Code Obfuscation (either through a automated tool or hiring a expert on it as a consultant for your project). See "[How to protect .Net exe from Decompiling/Cracking](http://stackoverflow.com/q/11711446/80274)" – Scott Chamberlain Jan 21 '14 at 19:21