472,146 Members | 1,586 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,146 software developers and data experts.

Dynamically loading assemblies...

I would like my application to be able to load modules dynamically and release them once they aren't needed. For example in c++ I would load a dll containing the required function, run it, then release the dll after it's no longer needed. What are my options in c#? From what I have read so far I can load assemblies containing the required code to execute but I can't release it without releasing the main application domain that loaded it. Is my only option to create another application domain where I can then load the executable and then release it by releasing that domain? It seems that this creates a lot of overhead to simply be able to unload those assemblies once they aren't needed. Any help or suggestions welcomed.
Nov 16 '05 #1
1 1800
Robert,

Unfortunately, creating a dedicated AppDomain and then shutting it down to
unload the assembly loaded seems to be the only option for now. This also
incurs making the classes in the loaded assembly derived from
MarshalByRefObject to be callable from the main AppDomain.

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx

"Robert Vasquez" <Ro***********@discussions.microsoft.com> wrote in message
news:34**********************************@microsof t.com...
I would like my application to be able to load modules dynamically and

release them once they aren't needed. For example in c++ I would load a dll
containing the required function, run it, then release the dll after it's no
longer needed. What are my options in c#? From what I have read so far I
can load assemblies containing the required code to execute but I can't
release it without releasing the main application domain that loaded it. Is
my only option to create another application domain where I can then load
the executable and then release it by releasing that domain? It seems that
this creates a lot of overhead to simply be able to unload those assemblies
once they aren't needed. Any help or suggestions welcomed.

Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Verane | last post: by
reply views Thread by Saiars | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.