Continuum Concepts

Edit Text in a .NET Assembly

I have a client that needed a text change made in an asp.net web app. Should be easy, right? The problem is that it's an old app, the text was hard-coded in the VB, and the source code is long gone! So how do you edit text that is already in a .NET DLL?

.NET Reflector to the Rescue!

  1. Get .NET Reflector and install it.
  2. Use .NET Reflector to open your assembly.
  3. Expand your assembly, and look for the class that represents the page you would like to edit. In my case it was "viewprintnotice", which represented "viewprintnotice.vb".
  4. Expand that class and click the method you guess the text was set in. I guessed Page_Load.
  5. Right click it and Disassemble.
  6. Did you find the code where the value was set? If so, take note. If not, keep digging until you find it. You can't make the change here, though. To actually edit, you need a plug-in.
  7. Download Reflexil.
  8. Install it.
    1. Close .NET Reflector (this step may not be necessary, actually)
    2. Drop its files into the .NET Reflector directory.
    3. Open .NET Reflector.
    4. View > Add-Ins.
    5. Choose Add, and double-click Reflexil.dll.
  9. Enable Reflexil by going to Tools > Reflexil.
  10. Navigate back to your assembly's class's method that set the text.
  11. Find it under Reflexil's Instructions tab. This may take a bit of digging.
  12. Right-click the instruction, click edit, and make your changes. Update your changes.
  13. Navigate to your dll and click it.
  14. Reflexil will let you save it!
  15. Save it and drop it into your server's bin directory and you've made your text edit.
  16. Take a shower because what you just did was dirty.