469,962 Members | 2,365 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

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 1712
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
1 post views Thread by rainxy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.