0
votes

Is it possible to force .net application to load another .net assembly from the start via app.config manipulation or any other way?

I want to make another application to load my assembly in it's process boundaries when it starts. Please, don't ask me why :) I just try to to walkaround legacy application lack of extensibility.

There is a problem - I have to extend legacy application UI by accessing controls tree. So I wish to access Main Form instance as System.Windows.Forms.Form instance class. It's impossible from another process so I have some thoughts how to inject assembly in legacy application boundaries and use my assembly code further.

The problem I fight with: WinForms: Form.FromHandle returns null for process main form for code loaded into .net executable

2
Yes it is. Try the magic google 8-ball for leads to ask a better question.user166390

2 Answers

1
votes

If the program makes any use of Debug or Trace statements, you can create a dummy TraceListener, that hooks up to the UI the first time Write or WriteLine is called.

0
votes

That should be possible to do using Assembly.Load and that family of methods. If that doesn't work because the application requires all references upfront (it jut depends on what's going on at the time of starting your app), maybe you could load things in a different app domain and do things that way?

Of course the current design may prevent such a things. What have you tried?