C# and VB code de-compilation and recompilation

As now days the c# and vb based business application are rapidly increasing due to its easiness and productivity rate developers are moving toward it.it use .net platform for development the .net have the similar architecture design like Java the code is compiled to .exe or .dll library those binary's are basically the MSIL(Microsoft Intermediate Language) or CIL (common Intermediate language) which is then compiled and executed by the .Net Just in time compiler the process is as bellow

In the above diagram we have shown the process of execution of .net based application the application is firstly compiled to to MSIL or CIL from all languages these are saved as .exe or .dll which exhibit the binary format so the code is used to be compiled by the CLR (Common Language Runtime) which will execute the .exe or the .dll on machine based instructions
The .net platform give us many great feature that create once and execute on any machine which have the platform installed here we do not have the need to change a single instruction and we just execute it.The applications are mostly developed in C# which is the newest and advanced easy language which contains all the great features of old languages or we can say that it is developed from the good features of those languages which were in past. .exe and .dll can be both de-compiled easily but disassembling is also possible easily but in first we will discuss the de-compilation process

C# and VB .exe and .dll de-compilation

Ø Go to http://www.ilspy.net/ and download ILSpy
Ø Download the binaries
Ø It would be in .zip formate extract it to some directory
Ø Double click on the ILSpy.exe
Ø The window will pop up
Ø Next step is to go to File menu Click on Open
Ø Select your required file which may be .exe or .dll and Open it
Ø You will get the following form of your code

Ø Now the next Step is go to File menu
Ø Click on Save Code

Ø The File would be saved as .csproj
Ø Which is the default project file of C#
Ø Now open it in the Visual Studio remove the errors and Redefine the references of which libraries are not saved in .csproj
Ø Make changes in it which you want

Recompilation of the c# (.csproj) project

As the .csproj is the default C# project file so open it in C# make changes in it for which you have de-compiled the project and remove the errors from it and click on Run.
The process is easy but you know that practice make a man perfect you have to do those things repeatedly and you will learn the fastest ways for doing this there are a lot of other Open Source and closed source tools but the one which we have used (ILSpy) is also good so use it and work on different types of tools and a day will came when you will get your way of doing those things faster
It is Really a funny work and you will get a lot of fun out of it.It will also teach you that how the things work in real so this is your start we have started the thing from De-compilation of Java and C# because if you directly start from the disassembling you will newer enjoy learning it because the disassembling needs more efforts than the de-compilation so practice on it you will get a lot of c# based program from web

1 comment:

  1. Want to learn C# from basics & in most professional Code development style. I'll have you writing real working applications in no time flat-before you reach the end of course.
    Hire C# Teacher.