470,624 Members | 2,148 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,624 developers. It's quick & easy.

Loading assemblies dynamically

Hi all,

I am working with C# and Visual studio 2003.

What I want to do is the following :
I have 3 assemblies, let call them A.exe, B.dll and C.dll.
I want to dynamically load B and C when A is loaded.
B and C are statically referencing A.

Those three projects are in the same solution called mySolution.
Under the directory 'mySolution', I have three subdirectories called
'A', 'B' and 'C' and each of them has subdirectories such as 'bin' and
'obj'.
By default, A.exe is generated in mySolution/A/bin/debug, B.dll is
generated in mySolution/B/bin/debug...and so on.

My first idea was to generate all the three assemblies in
mySolution/deliverables. A is then able to dynamically load B.dll and
C.dll (as they are in the same directory), but it seems to have some
bug in visual studio when some assemblies referencing each others are
outputing to the same directory. I have often some messages that a dll
can not be copied to its output directory. I have also some problems
if I defined a user control (UC1) in A and try to create a derived
user control from UC1 in B.
So this is not a good solution...

My second idea was to generate my assemblies in the default
directories (bin/debug for each) and use a config file to tell A where
to find B and C.
I wrote something like :

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<assemblyBinding wmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="test" />
</assemblyBinding>
</runtime>
</configuration>

But I think that as private path, I can only specify subdirectories of
my application path.
By the way, what is the application path in my case ?? Is it
mySolution/A/bin/debug ??
In that case, I can not tell A to look at mySolution/B/bin/debug and
mySolution/C/bin/debug ?
Should I change my organization and put B and C in a subdirectory of A
??
How ever, I tried to copy B.dll in mySolution/A/bin/debug/test, and
using the above configuration file (that I named
"myapplicationName.config"), it doesn't work at all, it says it was
not possible to find B.dll...

So I am a litle bit lost !
Does someone knows the right way to achieve what I want to do ??

Thanks by advance for any help,
Verane.
Nov 16 '05 #1
0 1213

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by dale cyr | last post: by
4 posts views Thread by Barry Kelly | last post: by
4 posts views Thread by BrianS | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.