Decompile a .NET assembly using ildasm.exe and edit and recompile it using ilasm.exe
Although there is no tool that allows you to see the source code of a compiled assembly, there are tools that are shipped with the .NET framework that will allow you to decompile a .NET assembly using ildasm.exe and edit and recompile it using ilasm.exe. The decompiler shows method signatures and member variables, but the code is in .NET byte code. The .NET byte code is extremely hard to modify for an ordinary programmer.
If Visual Studio <2005> is installed on your machine, the tools are located at C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\ildasm.exe. It's easier to use Visual Studio Command Prompt to start the tools. Otherwise they are located at C:\Windows\Microsoft.NET\Framework\<v2.0.50727\> and are on every computer that has the .NET framework installed.
"ildasm.exe" is Microsoft .NET Framework Intermediate Language (MSIL) Disassembler. First load your .NET assembly and then you can dump the IL code to a file and modify it. Then recompile it via ilasm.exe, which is MSIL assembler. After modifying your code, you would then recompile it using "ilasm.exe 'FileName' /DLL.
Traditionally the compiler (eg native c/c++) compiles the source into machine code so it’s hard to do reverse engineering. The issue with a .net assembly is that it can be decompiled into an IL via ildasm.exe. To prevent the reverse engineering of the .net Intermediate Language, a Dotfuscator profession edition needs to be used before your application is released. With Dotfuscator, the function or method names, namespaces and so on are renamed. It will be near impossible to modify the obfuscated .NET byte code.
See more details about MSIL Assembler (Ilasm.exe) at
http://msdn.microsoft.com/en-us/library/496e4ekx(VS.85).aspx
There are also many other important tools available from Visual Studio Command Prompt, such as Microsoft .NET Assembly to Type Library Converter: TlbExp.exe and TlbImp.exe.