简体   繁体   中英

Change one cs file in C# dll

I have no idea about C# programming.

My problem is that I have one DLL file consisting of many .cs files. One method implemented in one of those .cs files is written poorly and slowing down the whole application. I tried to decompile whole DLL with NET Reflector and succeed but with 14 errors. Then I improved my one .cs file and tried to compile all .cs back to .DLL once again. As you suspect, I ended with more that 100 compilation errors in Visual Studio. I assume this is happening because of poor quality of the decompiled code.

Is there anything that I can do with it without spending 1000 hours to learn C#, understanding all 10MB of source .cs files, rewriting them and compiling back to DLL?

if you still looking to change dll, instead of extending the class, you can use IL spy with reflexil .

  • this allows you to change the dll and save it.
  • you can make small changes to the DLL easily.

You can't change a .cs-File in a DLL, because a DLL does not consist of files, but IL code instead - at least, when you talk about a .Net-Library.

You can decompile the DLL, change the code and recompile it, but decompiled code probably won't be able to be compiled again, depending on what exactly the original code contained.

If there is no source available for the DLL, you will probably not be able to change the way a DLL behaves.

You may try to extend the class in a DLL by inheritance and use your "Updated version" instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM