Have you ever liked an application to the point that you want to view its source code? Well, I have been there. For .Net executable files and libraries such as DLL files, viewing the source code is a piece of cake as long as the code is not obfuscated by the developer. In this article, we are going to view the source code of a .Net DLL file as well as obfuscating it. The process of viewing the source code of an executable file is the same.
To create a DLL you can check this article of mine
Viewing source code using JetBrains dotPeek
JetBrains dotPeek decompiles an executable file or DLL/.exe file written using .Net to their equivalent C# code.
Installing dotPeek
- Download JetBrains dotPeek from JetBrains
- Run the setup and install free .Net decompiler and assembly tools.
Decompiling the code
- Open dotPeek
- File -> Open -> navigate to your project -> select your .DLL/.exe file
- Your project will be listed in the projects on our dotPeek under
Assembly Explorer
- Click your project and find the classes to view the source code
My file is called MyCalculator.dll
and bellow is the source code
Obfuscating the source code
For more obfuscating tools both open source and paid versions check this NuGet obfuscator article
In this article, I'm using one from the article, and its called Eazfuscator.NET to hide source code for a C# application. I will be using a simple C# calculator. You need to download and install Eazfuscator.NET here.
NB: Eazfuscator.NET is not free since version 3.4 but it has a trial version and the last free version 3.3 does not support .Net 4.5 and higher
Steps for hiding the source code
- Open your application in Visual Studio
- Change your project from
debug
mode toRelease
mode - Open Eazfuscator.NET then drag and drop your project from
solution explorer to protect it
- Rebuild your project and click reload all
If you open and check your .exe/.DLL file using dotPeek you will notice that your source code is now obfuscated.
Disclaimer: I am not affiliated with Gapotchenko (Eazfuscator.NET). This article is for educational purposes.
Top comments (0)