1

I have a web service written in c# and .Net, I have the following questions:

  • what happens when I choose to publish the project ?
  • will the code still be readable ?
  • and if not, how easy it is to reverse it ?
user990423
  • 1,397
  • 2
  • 12
  • 32
Yomash
  • 25
  • 4
  • Number 2 and 3: [Its really easy](https://www.google.com.do/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#newwindow=1&q=how+to+reverse+c%23+dll) – Misters Sep 08 '15 at 18:18

3 Answers3

1

what happens when I choose to publish the project ?

it compiles the project (to .dll files) and export your project to a folder

will the code still be readable ?

yes, by using Reflector

and if not, how easy it is to reverse it ?

very easy.. just install Reflector..

Mohamad Shiralizadeh
  • 8,329
  • 6
  • 58
  • 93
0

When you perform publish action in Visual studio or MSBuild it just compiles the code and copies it to some particular target location.

Compiling changes your readable source code to more machine readable form. In C# and other CLR based languages (i.e. VB.NET) the output is Intermediate Language (IL). This language is not as itself human readable, but it can be relative easily reverse engineered back to C# with many different tools.

When compiling happens, code will change to perform some optimations for the code, so the reverse engineered code will most likely not look exactly like the original source. Comments and other parts of the code that don't affect the execution, are removed.

There are tools to obfuscate code before it is compiled. For example dotfuscator will be shipped with the Visual Studio. Unfortunately these obfuscations can be quite easily reversed by those same tools that reverse engineer the compiled C# code.

Tuukka Lindroos
  • 1,270
  • 10
  • 14
-1

what happens when I choose to publish the project ?

enter image description here

Your C# code is complied to managed DLL file which is red color box in the picture.

Only C++ can write unmanaged code which is very hard to decompile.

will the code still be readable ? and if not, how easy it is to reverse it ?

Yes, it is quite easy. You can use the following tools to decompilerthe source -

Obfuscation does not provide 100% code protection. The bottom line is do not host your web application if you do not trust the hosting service.

Credit: picture is from Illustrated C# 2012 by Daniel Solis

Community
  • 1
  • 1
Win
  • 61,100
  • 13
  • 102
  • 181
  • There are many languages that compile to native code, C++ is certainly not the only one. – svick Jun 09 '16 at 19:12
  • I won't disagree with you, but OP explicitly stated .Net in the question. – Win Jun 09 '16 at 20:15
  • 1
    But C++ is not a .Net language. C++/CLI is, but that compiles to IL and can be relatively easily decompiled. – svick Jun 09 '16 at 20:22
  • Your comments becomes sidetracked. I never said that C++ cannot be compiled to CIL. Besides, even Microsoft refers C++/CLI as C++ for short. – Win Jun 09 '16 at 20:35
  • What I'm saying is that you can choose only one: Either C++ (in the form of C++/CLI) is a .Net language and can be easily decompiled, in which case that statement is wrong. Or C++ is not a .Net language, but then it's not the only one, and that statement is also wrong. You can't mix and match and say something like: "C++ compiles to unmanaged code and it's the only relevant language here, because C++/CLI is a .Net language". – svick Jun 09 '16 at 20:41