Click here to Skip to main content
15,867,488 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Is it possible to modify a referenced dll in visual studio? If yes, How?
Posted
Comments
Sergey Alexandrovich Kryukov 18-Dec-11 14:40pm    
This is one of the cases where you really should explain why. Does not seem to make sense.
--SA

Yes.
If you have the source code, it's easy, and pretty obvious.
If you don't, it is possible, but much harder, particularly if they have obfuscated their code to prevent people stealing their code.
 
Share this answer
 
Comments
Shining Legend 18-Dec-11 5:41am    
I have the dll file. Now using .NET Reflector I can see the code but how do I modify the code in that dll?
1. Save the code Reflector gave you to the file system
2. Create a project from these files
3. Compile the project
4. Verify that your compiled DLL still functions the same as the original one.
5. Edit the source code to add/change whatever functionality you want/need
6. Compile
7. Check for validity of the added/changed functionality
8. Apply 5. 6. 7. ad nauseam or until desired result is achieved
9. Use the new DLL instead of the old one where you previously used it.

Cheers,
Manfred
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 18-Dec-11 14:40pm    
Accurate! My 5.
--SA
Manfred Rudolf Bihy 18-Dec-11 15:08pm    
Thanks SA, I forgot one step though where the new DLL replaces the old one. FTFM!
Depends on what you mean be "modify" - Yes.

A modification that might be needed some times is to make a dll strong named.
For such modification, use ILMerge.

Or you might want to decorate the dll with some aspects. If you want to do that, and if you have the right version of Visual Studio, you might use VSInstr and its companions for tracing function calls, etc.

Or, if sufficiently sophisticated, you might use ildasm & ilasm and patch the code in between ;-)

Cheers
Andi
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900