Recompiling code into a .dll
Hello, Asp.Net newbie here. I posted an earlier question about missing codebehind files, which I have since had answered.
I have an Aspnet 1.x website with .aspx and .dll files on the server, but not codebehind files or source code available from the previous developer.
I have used Lutz Roeder's Reflector program to decompile the .dll, and now I can see all the juicy codebehind for each of the pages of the website.
My question now is this:
I want to make some minor changes to validation code. Can I take all the VB code reconstructed by Reflector, pour it into a new Codebehind page with the changes I want to make, and recompile just that page?
This seems pretty straitforward, but I want to be sure I am not about to screw something up. Will I need to reconstruct all the VB codebehind pages for the whole site for it to recompile, or is one page ok?
Reconstruction of one page is enough.
But be sure that u recompile the whole thing.
Actually, nothing needs to be precompiled, if the application is just republished (as in simply the new files are on the server), it will compile at application runtime. This is if you want to get away from precompiled applications, though there will be a little performance loss, but you will not notice it except on application start since the server will be running a compiled version of your app no matter what.
Originally Posted by PeOfEo
Thanks very much for the replies.
I don't really care about a slight difference in performance - it is just a simple online store app. If I can get away with resurrecting that one codebehind page, adding the change I want to make, and putting it up - that is, if it can incorporate that one codebehind into the dll without needing all the rest of the missing codebehinds as well - then I should be all set.
I'm not sure if Chitra Xavier's solution will work or not since both DLL's will reference the same namespace and class. Maybe it will because the DLL compiled with the single code-behind is newer, it'll replace the previous code-behind. Let us know how that works out.
If his suggestion doesn't work, you could change the name of the code-behind, compile a new DLL and then change the code-behind reference in your aspx page's page direction.
Otherwise, if you choose to just decompile the whole site's code. Be sure to look at Reflector's add-ins. It has one that will decompile the whole library to files. I've had to do that once already and it was relatively easy. We had a developer who developed on a working copy and absolutely never made iterative back-ups. When she left, her code was in the middle of development and of course there was no snapshot of the production code.
I see what you mean. Since the site is actually running now and taking orders, I want to be able to restore it quickly in case my small change "breaks" the .dll upon recompile.
Originally Posted by Cstick
If I copy the current .dll onto my HD, I can paste it back in to the FTP site, in case the modified one doesn't work? Or is this not as simple as it seems?
Yes, always backup... Generally, yes, it is just that simple. On rare occasions I've had IIS start acting buggy afterwards and requiring restart, but that is far and few.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)