views:

363

answers:

5

Long story short, VSS decided I wasn't allowed to have some code changes. I am missing a decent sized feature that I don't want to have to re-write (gave to a co-op as work this past summer). It works great and does what the client wants. However... I don't have the machine and the machine it was developed on has since been paved low!

Do'h!

We published the site into a test environment straight from visual studio and then we copied the files into production. So I have the "compiled" files from the VS publish.

How can I go about getting that back into code? I am sure I can figure out which DLL it is in and I would assume that something like reflector is going to be my best bet? Are the original variable names retained?

+8  A: 

I would use .NET reflector. Your original variable names will be preserved (providing you did not run any kind of obfuscator) if you have the PDB files as well as the DLLs.

AdamRalph
IIRC (method) variable names don't exist unless you have the matching pdb.
Marc Gravell
fair enough - hopefully he has the pdb! ;-)
AdamRalph
Re comment: now delete the pdb and try again...
Marc Gravell
Bleh, no pdbs. I am not sure if publishing the website keeps those or not by default. I know I didn't change anything. Not obfuscated these are all internal webapps and things I work on. No reason to obfuscate the code really.I didn't think there was a magic answer, but was hoping something might exist beyond reflector.There are a bunch of .compiled files in the directory in addition to the DLL files... not sure what they are for.
bdwakefield
oh dear. well, at least Reflector will still give you the source code, albeit with meaningless variable names. Perhaps still better than starting from scratch. Have edited the answer WRT to PDBs.
AdamRalph
Gave me what I needed. Kept all the object and functions named properly. Only the local variables were named "str1" "str2" etc. Perfectly readable. It helped I knew what I was looking for in which files. thanks!
bdwakefield
+3  A: 

I would suggest trying to reflect your compiled code and see how readable it comes out.

http://www.red-gate.com/products/reflector/

sparks
Reflector works well. You're even able to specify C# or VB to display when you're browsing the compliled code.
Chris
+1  A: 

Reflector all the way. You can't rely on local variable names since they don't really exist (only fields retain their names), but having the matching pdb would go a long way to helping. If you use the pro/EAP version of reflector it will do must of the work for you (generating the full C# disassembly etc, so you don't have to go method-by-method or use a plugin).

You may still need to look at each directory separately, of course.

Marc Gravell
+1  A: 

Best you are going to get is with a decompiler like this http://www.red-gate.com/products/reflector/. You are going to lose variable names and comments, but what you get will compile.

Sucks, but probably a lot better then starting from scratch.

Matt Briggs
A: 

Salamander - a .NET decompiler http://www.remotesoft.com/salamander/index.html

I've never used this tool, but they talked about it on .NET rocks! a while back. http://www.dotnetrocks.com/default.aspx?showNum=194

Booji Boy
Yikes is that 'spensive!
bdwakefield