473,396 Members | 1,996 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,396 software developers and data experts.

Loading an Assembly not in my current appdomain.

I wan't to be able to deserialize a class from an assembly that is not in
the application domain. To do that I must have the Type from the Assembly.
How do you get a Type from an assembly that is not in the manifest of the
current AppDomain. I have tried different ways but get exceptions from all
of them that say the:

assembly or one of its dependancies could not be found.

There must be missing something.
Nov 15 '05 #1
4 2862

Hi Mark,

Thank you for posting in the community!

Based on my understanding, you want to use some class in an assembly which
has not been loaded into your application's appdomain.

=====================================
Actually, to explicitly load assemblies into appdomain, .Net provides you 3
methods to do this: Assembly.Load(), Assembly.LoadFrom(),
Assembly.LoadWithPartialName(). Please refer to the document of them in the
MSDN.

I suggest you always use Assembly.Load to accomplish your loading work,
because:

Assembly.Load()
1). If the assembly is strong named, Assembly.Load() will use assembly
name, version, culture and public key token to identify the assembly. The
CLR will first look in GAC, then in application's base directory, last in
private path directory.
2). If the assembly is weekly named, Assembly.Load(), the CLR will not look
in GAC.
3). You should pass the assembly name to the Load() method(Without file
extension)

Assembly.LoadFrom()
You pass the pathname of the assembly(With file extension), and can not
contains strong-name information, and the CLR does not search in GAC for
you.

Assembly.LoadWithPartialName()
You should always avoid using this method, because an application will not
know for sure what version it is loading.

For more information, please refer to "CLR Hosting, AppDomain, and
Reflection" in Jeffrey Richter's "Applied .Net Framework Programming".

After you have loaded the assembly, you can use reflection to use the class
in that assembly.(For example, use Assembly.GetType() to get the type of
the class)

==========================================
Please apply my suggestion above and let me know if it helps resolve your
problem.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.
Have a nice day!!

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 15 '05 #2
Oh, I think the article below may also help you:
http://www.gotdotnet.com/team/clr/Lo...Isolation.aspx

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 15 '05 #3
I assume that by 'deserialize' you mean 'load'?

Than you have to load the assembly which has your class.
If the class has some static fields with types that are in the other
assemblies it is quite possible that you will get the 'assembly or one of
its dependancies could not be found.' error, because runtime couldn't found
that assemblies.

You can use Reflector tool ( http://www.aisto.com/roeder/dotnet ) to obtain
the dependant assemblies.

"Mark" <no************@technologist.com> wrote in message
news:eg**************@TK2MSFTNGP09.phx.gbl...
I wan't to be able to deserialize a class from an assembly that is not in
the application domain. To do that I must have the Type from the Assembly. How do you get a Type from an assembly that is not in the manifest of the
current AppDomain. I have tried different ways but get exceptions from all of them that say the:

assembly or one of its dependancies could not be found.

There must be missing something.

Nov 15 '05 #4
Thank You. That helped and it is working now. Much simpler than expected.

"Mark" <no************@technologist.com> wrote in message
news:eg**************@TK2MSFTNGP09.phx.gbl...
I wan't to be able to deserialize a class from an assembly that is not in
the application domain. To do that I must have the Type from the Assembly. How do you get a Type from an assembly that is not in the manifest of the
current AppDomain. I have tried different ways but get exceptions from all of them that say the:

assembly or one of its dependancies could not be found.

There must be missing something.

Nov 15 '05 #5

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

Similar topics

2
by: Foehammer | last post by:
Hello, I'm trying to load an assembly dynamically using an app domain. This is a proof-of-concept for a larger project, so please excuse the lame class names. TestLib is the dll where all the...
3
by: Mike Krueger | last post by:
Hi I'm currently working on a forms designer for a free .NET IDE (SharpDevelop -> www.icsharpcode.net/OpenSource/SD). problem: I try to put 'custom' components (user controls from the current...
2
by: Stelios | last post by:
Does anyone know how to dynamically load an assembly from a location other that the working directory by using Assembly load method. It is important to use the specific method because is the method...
6
by: Pete Davis | last post by:
I'm confused about what precisely the limitations are on loading plugins in separate app domains. In all my previous apps that supported plugins, I've loaded them into the same domain as the app,...
4
by: Barry Kelly | last post by:
I'm designing an application framework which will, amongst other things, live in an assembly hosted in the ASP.NET worker process, servicing webservice requests. Here's the scenario: APPFX is...
0
by: Fred | last post by:
Hello, I am using a separate app domain to load an assembly from either disk or cache, create an instance of it and run a method. I then call dispose on the created instance and unload the app...
1
by: Andrew Ducker | last post by:
I'm trying to load an assembly into a temporary AppDomain rather than my main AppDomain, so that it can be unloaded later on. However, it's also loading into my main AppDomain at the same time. ...
2
by: jnick | last post by:
I have the predicament of having to load several assemblies on the fly and when I do so, I get an exception stating that one of the referenced assemblies cannot be found. Is there any way to...
0
by: Ratul | last post by:
Hi all! I'm writing a winforms test harness which lets me specify a subfolder from which to load a particular .net assembly dll. The idea is that there will be multiple subfolders, each having...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.