Click here to Skip to main content
15,888,002 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello
i want any simple solution for hook app .net core by harmony during runtime

because i have a problem for loading native file and hook library dll in .net core

i can hooking this app on .net framwork but on .net core i can't loaded file.exe because it is native

What I have tried:

C#
var executable = Assembly.LoadFrom("File.exe");
Assembly.LoadFrom("Lib.dll");
Patch();
var moduleHandle = executable.ManifestModule.ModuleHandle;
RuntimeHelpers.RunModuleConstructor(moduleHandle);
//Injection
UnPatch();
Posted
Updated 8-Jan-23 14:14pm
v2

1 solution

Why do you want to modify someone else's code ? modding a game ?

put more details in your question

Why n0t contribute to the Harmony open-source project by raising an issue on GitHub, or use the resources here: [^]
Quote:
Documentation
You can learn more about Harmony by using the top menu links. The main section [Harmony] brings you to the full documentation that explains everything about Harmony and gives you lots of high level examples. In the second section [API Documentation] you can browse the public API and all its methods and classes.

If you find a factual error or if you have feedback about the documentation you are welcome to fork the repository and create a pull request
file a documentation Issue on the repo
or write about it on the official discord
New to modding and C#? Beside the basic language features you need at least a good overview of Reflection in C#. Read this short and useful introduction.

Community
If you feel stuck or have questions that this site does not answer, feel free to join the official Discord Server or file a GitHub Issue.

Help by promoting this library so other developers can find it. One way is to upvote this stackoverflow answer. Or spread the word in your developer communities. Thank you!

Contact
Andreas Pardeike
andreas@pardeike.net
twitter: @pardeike

 
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