tags:

views:

1525

answers:

3

HI, Is there a way to prevent a particular dll in C# being opened in reflector. I can open many of the dll's and can get the code using reflector. But when trying to open some dll's it shows an error message stating that "The particual dll does not contain a CLI header.".

How can I make a dll like this??

+10  A: 

Are you sure that these DLLs are managed-code-dlls? I don't think so, if they don't contain the CLI header, they aren't written in C#.

And for your question, you can't prevent a managed-DLL from being opened in a decompiler, all what you can do is to obfuscate it.

Moayad Mardini
or any other .net language for that matter...
Pondidum
Sure, I mentioned C# in particular because he asked about DLLs written in C#.
Moayad Mardini
Why can't the CLI Header be removed, like DEVENV.EXE?
AMissico
+2  A: 

If you want to protect your .net dll you could obfuscate your assembly

Free .NET Obfuscation Tools

You have commercial ones too...

"The particual dll does not contain a CLI header.". message appears in Reflector because they are not managed dlls (.net).

abmv
You can not protect managed DLL from being decompiled, you can only make it harder to understand the decompiled code with obfuscator.
smok1
Exactly true...
abmv
+1  A: 

I thought there was once a certain IL code which caused a crash in the reflector. But this bug is fixed now.

Obfuscation is nice - You can also try to encrypt certain critical parts of your code and decrypt+load+compile it at runtime. The problem is how to store the password.

You can't prevent it from being opened by the reflector.

Dario