473,386 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

How do i dynamicaly load and unload a C# dll at runtime

How do i dynamicaly load and unload a C# dll at runtime

Nov 16 '05 #1
3 3158
Hello Daniel,

You can't do that.
How do i dynamicaly load and unload a C# dll at runtime

Nov 16 '05 #2
Actually you can do this. You will need to look into crating new
application domains (via System.AppDomain.CreateDomain), using
reflection to load the dll that you are interested in (see the
System.Reflection namespace), then unloading the AppDomain when you are
done with the dll (using System.AppDomain.Unload).

If you are interested in seeing an "in production" working example of an
application that can do this, take a look at NUnit. NUnit allows you to
replace the test DLLs at runtime and the application will unload the
ones it was using then load up the new ones.

Hope this gets you going in the right direction.

Have A Better One!

John M Deal, MCP
Necessity Software

Hayato Iriumi wrote:
Hello Daniel,

You can't do that.
How do i dynamicaly load and unload a C# dll at runtime


Nov 16 '05 #3
I'm not sure if this is what you need.
You have a dll and you want to late bind...

take a look at the following code, it loads a form from a dll. Everything
can be configured at runtime...
string assembly = "ClassLibrary1.dll";
string method = "Show";
string type = "Form1";
Assembly assemblyInstance = Assembly.LoadFrom(assembly);
assemblyInstance.GetType(type).InvokeMember(method , BindingFlags.Public |
BindingFlags.InvokeMethod |
BindingFlags.Instance,null,assemblyInstance.Create Instance(type), null);
"Daniel" wrote:
How do i dynamicaly load and unload a C# dll at runtime

Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: ZhangZQ | last post by:
Is it possible to dynamicaly to local and call a function in Win32 dll(not a ..net assembly dll) in C# at run time, for example, a C# program popup a dialogbox to let use input which Win32 dll to...
1
by: Daniel | last post by:
How do i dynamicaly load and unload a C# dll at runtime
1
by: DB2 Novice | last post by:
Hi, What are the utils provided by IBM to fast load and unload DB2 in Unix and Windows env. I read about High Performance Unload and this is just Unload, waht about Load? What is the best way...
2
by: Patrick Blackman | last post by:
I have a program that search the application path for all the Dll that implement a certain interface IText ,when a Dll with the interface is found ,I run a method called IText.Format() which works...
2
by: Lauren Hines | last post by:
Hello, I have read numerous post stating that the only way to unload an assembly (DLL in my case) is to create a separate AppDomain, load the assembly, then unload it by calling AppDomain.Unload....
2
by: brianbender | last post by:
I am trying to load and unload assemblies dynamically and call methods and properties when loaded into an Appdomain I can load assemblies all day in the current AppDomain without references and...
2
by: Chris Dunaway | last post by:
I am using reflection to load an assembly dynamically at runtime. If there are classes in the assembly that implement a particular interface, I put an entry in a list for later use. My...
2
by: Artem | last post by:
When I use the method Thread.Abort, it only sends a request of aborting to OS to stop a thread. The thread itself isn't killed and allocated resources aren't released. I tried to run that thread...
6
by: Ronald S. Cook | last post by:
We have a Windows app that has one main form (a shell, sort of). We then load user controls into a panel on the form depending on what the user has selected. Our current code to unload the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.