0

I have a C# Desktop app.

I load a C# DLL into this app via reflection methods.

Is there a way to compile this DLL into native code?

The ultimate aim is to protect my DLL the best way I can. I know it will not be 100% proof but I just want to not make it easy to do so.

Thanks

Andrew Simpson
  • 6,883
  • 11
  • 79
  • 179
  • Why? The JIT compiles it to native code as required. – Lloyd Jan 03 '15 at 12:48
  • Hi @Lloyd, I must have misunderstood what I have read. I wanted to protect my DLL from DotPeek - a JetBrains app. I read that if the DLL is compiled into native it can not be decompiled easily? I have tested this and DotPeek does disassemble my DLL. So, either it is not compiled to native code or the comment I read is inaccurate? Still learning all this so apologies if I have this wrong :) – Andrew Simpson Jan 03 '15 at 12:52
  • {appreciate your time BTW} – Andrew Simpson Jan 03 '15 at 12:52
  • 1
    Which one are you trying to protect? The app or the other dll? You need to add more details to your question. – Mert Akcakaya Jan 03 '15 at 13:22
  • Hi @Mert, thanks for your suggestion. Will update question now :) – Andrew Simpson Jan 03 '15 at 13:24

1 Answers1

2

Obfuscation is what you might be looking for. Please take a look at following links to arrive at a basic idea from your end, if Obfuscation meet your requirement.

.NET obfuscation tools/strategy

http://en.wikipedia.org/wiki/Obfuscation_(software)

http://msdn.microsoft.com/en-us/magazine/cc164058.aspx

Community
  • 1
  • 1
Siva Gopal
  • 3,474
  • 1
  • 25
  • 22
  • @AndrewSimpson I provided this answer as a hint based on your reply to Lloyd. – Siva Gopal Jan 03 '15 at 13:16
  • Hi, thanks for those links. i will look at them now. I was going to obfuscate anyway. I have been using DotFusicator from Premptive solutions but DotPeek did not seem to have much problem with it.. – Andrew Simpson Jan 03 '15 at 13:17
  • @AndrewSimpson You cannot protect something fully. Even a `native` binary can be disassembled eventually. – Lloyd Jan 03 '15 at 20:56
  • Hi @Lloyd, you are quite right. I just did not want to make it dead easy for anyone. I have moved the majority of my code to a web service but I have created an encoder for mages that compresses the byte array on client before sending to my server so it has to stay client side. I am going to have to look at copyright but that is only as good if you are prepared to financially defend it. – Andrew Simpson Jan 03 '15 at 21:01