I have an assembly which is not strong-named. I have no source code for it.
I now need to recover the source code . Is there a way to do this?
Use decompiler such as dotPeek or ILSpy.
Be aware of the fact that code is decompiled using IL code that resides in .NET assembly it may be different from the original code used when compiling the assembly.
I can recommend RedGate .NET Reflector. You can try 14 days trial version.
At work we used to use Reflector, until we learned that dotPeek is free. It serves us well.
Related
Can someone tell me if it is possible to view source code only using exe file. For example I have made project and in debug there is exe file so if I'll send this to someone he will be able to view it's source code(Using hacking tolls or by something)?
The answer is Yes
Your code can be de-compiled and can be seen.
I personally use this one for .net:
http://www.jetbrains.com/decompiler/
But it is not the only one, there are many decompilers exist.
Yep, there's Resharper or ILSpy
Certainly he/she can see your IL code, the code that has been constructed by your compiler. For instance, a tool for doing this is the MSIL Disassembler http://msdn.microsoft.com/en-us/library/f7dy01k1(v=vs.110).aspx. I suppose having the IL language it wouldn't be difficult to get the C# code.
You must use a decompiler as Net Reflector or JetBrains, anyway if your exe is obfuscated also them can not work
You can use the default ILDASM (IL disassembler) from VS command prompt.
Is there a tool which allows me to decompile a .net dll, edit it and repack it back to dll again?
I use dotPeek a lot. It can't repack or edit.
While Reflector is cool - but it's not free.
There is Mono.Cecil - which is a lower level tool that can modify assemblies. The two I now use most often are:
JustDecompile and DotPeek
Reflector is one of a kind. I have successfully created c# projects from binaries and recompiled them.
Bear in mind that protected assemblies are difficult to decompile, also they may be obfuscated or protected against ILDASM.
is it possible to see the source code of C# library implementations?
such as List or Dictionary implementation source code.
You can download the entire Microsoft .NET Framework Sourcecode at Microsoft's Reference Source Code Center.
You should be able to open up anything in Reflector (http://www.red-gate.com/products/reflector/) and view any of the framework source.
Yes. ReSharper helps by automatically downloading the pdb, if it is availabe from Microsoft, when you hit F12. Otherwise you can use Reflector.
Use this:
http://www.red-gate.com/products/reflector/
There is a free version.
There are other ways, like the Mono or Rotor source. In my opinion, Reflector is the simplest and most useful.
Yes, it is. You can decompile every .NET Assembly using Red Gates Reflector together with the appropriate AddIns.
You can use reflector for this
If you want to go one step further than reflector and actually step into the framework code while debugging, then check out this blog post from Scott Guthrie: .NET Framework Library Source Code now available.
It tells you how to use the Microsoft Symbol servers to get the framework code while debugging.
I use reflector to decompile a asp.net dll, after that I find the bug and fixed it, now I want to compile it back to a dll, then I can deploy, but it seems that I can't how can I do this ?
You have two choices, either you use Reflector's addin Filedisassembler, which is free, or commercial ( and pricy) .net dissemblers such as spices.net or salamander decompiler.
I used Filedisassembler; the quality of the decompiled code is very bad. The decompiler code cannot be recompiled.
I'm sure about the quality of commercial decompilers but I suspect that it would be much better.
Edit: To use Filedisassembler, go to Reflector, View->Addins, click Add and select the Filedisassembler.dll.
If the fix is simple enough and you know IL, you are better of round tripping it using IL instead of a high-level language such as C# or VB.Net.
See search: http://www.google.com/#hl=en&q=ildasm+IL+round-tripping
I am well aware that one can use reflector to browse the content inside an assembly, and one can use FileDisassembler to convert the content into the c# source code with cs projects. But the source code outputted by FileDisassembler may not be able to compile if it has interface with property.
Is the other similar applications that do what FileDisassembler does?
I would not trust Reflector's decompiler.
Many times I have seen it just ignore instruction it did not understand, or just optimized certain sequences away, and changing the meaning the process.
The only trusty way is to use IL.
Regarding more tools, look at the CCI. IIRC, they had a C# source emitter at some stage, but it was removed for some reason.
dotPeek from jetBrains is a good decompiler for c#. http://confluence.jetbrains.net/display/NETPEEK/dotPeek+Early+Access+Program