Late binding asseblies

T

tlwright1414

I have Assembly A which late binds Assembly B using the following
code...

Assembly b = Assembly.LoadFile(@"C:\dev\B.dll");
object o = b.CreateInstance( "NameSpaceB.ClassB" );
object oEmitObj = Activator.CreateInstance (o.GetType(),false);
object[] args = new object[1]{m_Arg1};
o.GetType().InvokeMember("Process", BindingFlags.InvokeMethod, null,
oEmitObj, args);

Assembly B contains a reference to an Assembly C. When I run the code,
I get an exception message saying that Assembly C cannot be found.
When i place Assembly C in the bin of Assembly A... then it works. Is
there a way around this? Ideally, I would like Assembly A to have
nothing to do with Assembly C because the assemblies are bound
dynamically, and I don't want to keep having to put new assemblies in
A's bin each time I build a new one.

Thanks in advance for responses.
 
Y

Yunus Emre ALPÖZEN [MCAD.NET]

u should load assembly c before loading assembly b.

But it wouldn't be so nice. So load assembly c in assembly B dynamically.

Assemblies are not embedded !! One solution is use early binding means just
add a reference from VS.NET. If u had to use late binding u should load
assemblies in order.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top