What are the challenges you face when working across database platforms? Take the survey

How to add new reference dll by using .NET Reflector

hungtd7hungtd7 Posts: 5

I'm newbie in .Net Reflector. How can I add new reference dll?



  • Options
    Jessica RJessica R Posts: 1,319 Rose Gold 4
    Hi and thanks for your post!

    Do you mean how to add a new dll to be decompiled in the desktop application? Or how to enable debugging on a dll when using the Visual Studio add-in?

    To decompile an assembly in the desktop application, you can either go to File>Open assembly and choose the assembly or just drag and drop the .dll file into the object browser (on the left-hand side).

    To enable debugging on a reference dll when using the Visual Studio add-in, open your solution, then go to the .NET Reflector Object Browser (you can open it by going to .NET Reflector>.NET Reflector object browser), right-click on the dll you want to debug into, and choose "Enable debugging". You can also enable debugging by going to .NET Reflector> Generate pdbs... and then choose the assemblies you want to debug into.

    I hope that helps but please let me know if I've misunderstood or if you have any other questions!

    Jessica Ramos | Product Support Engineer | Redgate Software

    Have you visited our Help Center?

  • Options
    Hi Jessica

    For example:
    1. I have a dll/exe file.
    2. I code new dll and want to call a function in dll (2) from dll/exe(1).

    Can I do that?

    Thanks for your support
  • Options
    Jessica RJessica R Posts: 1,319 Rose Gold 4
    Ah okay, thank you for clarifying! If you don't have the source code for the dll/exe but want to change its code to call on the new dll, the following may help:

    - Open the Reflector desktop application
    - Go to Tools>Options and under Disassembler, make sure that language is set as needed
    - Load your dll/exe into the Reflector object browser if it's not there already
    - Right-click on the assembly and choose "Export source code" (make sure to right-click on the assembly node – if you are on a namespace or class node, the option is not available)
    - Click 'Start' and the cs/vb source files and csproj/vbproj file will then be created for the project in the specified output directory.
    - You can then open these in Visual Studio, change the code to add the call to the new dll as needed, and then rebuild the project

    Please note though that code regeneration is unfortunately not perfect, so the source code that Reflector generates may not be in the original structure and may not be readily compilable--you may have to go in and manually fix any errors and remove any illegal characters. (If you are finding many illegal characters, it may be because Reflector is using your pdb symbols. If so, you can uncheck the "Show PDB symbols" option under Tools>Options>Disassembler and then export the source again.)

    I hope that might help!

    Jessica Ramos | Product Support Engineer | Redgate Software

    Have you visited our Help Center?

Sign In or Register to comment.