S
S
Sergey Karbivnichy2020-12-22 22:25:20
.NET
Sergey Karbivnichy, 2020-12-22 22:25:20

Is it possible to replace the dll assembly in .Net?

For example, simple code:

using System;

  class Program
  {
    public static void Main(string[] args)
    {
      Console.ReadKey(true);
    }
  }

After the assembly, I load it into the decompiler, and I see that the program uses mscorlib.dll at: C:\Windows\Microsoft.NET\Framework\v4.0.30319

Is there a list of directories in which assemblies are searched, or are they hardwired? And is it possible, without editing the application, to force the use of mscorlib.dll from another folder?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
V
Vasily Bannikov, 2020-12-22
@vabka

Yes - you can put it next to the executable, for example. But with mscorlib, this most likely will not work, because this is a signed assembly and the application will look for a specific assembly

V
Vladimir Korotenko, 2020-12-22
@firedragon

Maybe this will lead you to something.

C:\Users\kvn>echo %windir%
C:\Windows

However, if the PE loader finds this library somewhere earlier. And this already needs to be looked at in PSDK. It might start

F
freeExec, 2020-12-22
@freeExec

Can put it next to the .exe file.

D
d-stream, 2020-12-22
@d-stream

Well, you can create a separate application domain and load assemblies there via Assembly.LoadFrom
+ it's useful to hang your own handler on the CurrentAppDomain.AssemblyResolve event, which will slip the right
one The only question is - why is this necessary for framework assemblies? Try to run the program without the framework installed?)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question