473,654 Members | 3,103 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

loading "private" assemblies

Hello

I emply a "plug-in" architecture for a .NET Windows service. At OnStart, the service browses for DLL's in in sub-folders and loads them dyanamically using Assembly.LoadFr om()

The service executable is placed in its own folder with the assemblies required for its successful complilation. Each plugin is also stored in its own folder with the associated assemblies required for its succesful compilation ( the bin/release folder contents are copied to the run-time destination.

My questions is/are: If the service uses a common Assembly (such as My Utils.dll) that is also used by one or more plugins, will the plugin run-time code be pointed to the already loaded assembly or will the one in its physical location be loaded with it? Suppose they were built using the exact same version of the common assembly? And lastly, is it possible to specify that each plugin "use" the assembly in its own folder and not one that may have been loaded previously

Nov 16 '05 #1
4 2004
Hello

I will answer your last question first. It is possible to create multiple
application domains and specify a different path for probing assemblies for
each application domain. This leads to the your first question, if you do
this the assemblies will be loaded multiple times.

I don't know what will happen without application domains but i think that
multiple copies will be loaded too.

Best regards,
Sherif

"BillyMac" <wo************ @noemail.noemai l> wrote in message
news:1D******** *************** ***********@mic rosoft.com...
Hello -

I emply a "plug-in" architecture for a .NET Windows service. At OnStart, the service browses for DLL's in in sub-folders and loads them dyanamically
using Assembly.LoadFr om().
The service executable is placed in its own folder with the assemblies required for its successful complilation. Each plugin is also stored in its
own folder with the associated assemblies required for its succesful
compilation ( the bin/release folder contents are copied to the run-time
destination.)
My questions is/are: If the service uses a common Assembly (such as My Utils.dll) that is also used by one or more plugins, will the plugin
run-time code be pointed to the already loaded assembly or will the one in
its physical location be loaded with it? Suppose they were built using the
exact same version of the common assembly? And lastly, is it possible to
specify that each plugin "use" the assembly in its own folder and not one
that may have been loaded previously?

Nov 16 '05 #2
Thanks for Sherif's suggestion.

Hi,

As for the first question that if we manually use Assembly.LoadFr om load a
certain assembly and then call a class or type within that assembly, how
will the runtime search the assembly?

Based on my understanding, I think the actual behavior depend on the
whether the two assmblies are exactly the same one. (it's full name ,
version, culture, ....).

Since your plugin is loaded into your windows service's main AppDomain,
yes? When it call a class or type w(which is in the common ultiy assembly
you mentioned), the runtime will first check the memory to see whether the
class/ type is already existed. This require complete match, include ,
type/class name, namespace, the certain assemly's full name(the type/class
is contained). If match, the runtime will use the one in memory, otherwise,
it will search the certain required assembly as normal( by order , GAC,
private path...).
Also, I think a simple test on this is more valuable. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 16 '05 #3
Hi - ok, thanks for the info. I will use that to do further tests. You may close this post.

best regards,

Bill
Nov 16 '05 #4
Thanks Bill,

I've also done some tests and found that the actual things a far away from
what I've expected originally. In fact, the Assembly.Load ,
Assembly.LoadFr om are quite different . Anyway, I think the following blog
will be helpful to you.

#Choosing a Binding Context
http://blogs.msdn.com/suzcook/archiv.../29/57143.aspx
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 16 '05 #5

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

Similar topics

10
3314
by: Scott Brady Drummonds | last post by:
Hi, everyone, I'm still learning Python as I develop a medium-sized project. From my previous experience with C++, I've burnt into my mind the notion of information hiding. I'm having trouble understanding to what extent I should follow this policy in my Python code so I thought I'd ask the group. I read from a previous post that to attain a private-like status of member variables, I should prefix the variable name with two...
5
2013
by: Steven Bethard | last post by:
Philippe C. Martin wrote: > class Debug_Stderr: > __m_text = '' > __m_log_text = None > __m_dbg = None > __m_refresh_count = 0 <rant> I don't see the benefit in 99.9% of cases for making class variables
1
362
by: BillyMac | last post by:
Hello I emply a "plug-in" architecture for a .NET Windows service. At OnStart, the service browses for DLL's in in sub-folders and loads them dyanamically using Assembly.LoadFrom() The service executable is placed in its own folder with the assemblies required for its successful complilation. Each plugin is also stored in its own folder with the associated assemblies required for its succesful compilation ( the bin/release folder...
8
2828
by: Etienne Boucher | last post by:
Nested classes are usualy objects made to only live in their parent object instance. In other words... public class Outter { public class Inner { } }
1
23183
by: Edward | last post by:
I have trouble with some of the concepts of OOP, and am struggling currently with Private Shared Functions. I think I understand Private (not available outside the class). I think I understand Shared (available without having to instantiate a class). So how could a Private Shared Function be called? Why give it this particular scope?
3
6703
by: Jordan Taylor | last post by:
I am confused about protected member functions and objects. Is there any particular advantage of declaring members protected?
0
1725
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 this dll. To ensure that there are no conflicts with similarly named assembly dll files, I'm am trying to load a subdirectory's dll into its own AppDomain. However when I call the AppDomain.CreateInstanceFromAndUnwrap method, it throws an...
2
4027
by: Joerg Toellner | last post by:
Dear Group, i develop an app with MSVC++ 2005 pro. My app should not use any installation. It's only a "packing out the zip and run it"-installation. So i use private assemblies with manifests and DLLs in the app directory itself. All works fine with MSVC2005 Pro PRE SP1. I packed into my app-zip also the Microsoft.VC80.CRT.manifest file and the redist-dll msvcr80.dll (i got them
4
1868
by: Peter K | last post by:
Hi if I am developing a "class library" which contains some classes which should be exposed to the outside world, and other classes which I really would rather have "private" to my library (helper/utility classes), how do I achieve this? Obviously public classes can just be declared "public". But how do I make classes available only to the other classes which are a part of my library?
0
4012
by: Luis Zarrabeitia | last post by:
Quoting Joe Strout <joe@strout.net>: I'm sure your credentials are bigger than mine. But he is right. A lot of languages have ditched the "concept" of a static variable on a method (how do you parse that sentence, btw?) in favour of using encapsulation. Of the top of my head, there is Java, C# and Python, and I think even PHP and Perl. They call them "private variables", including the name-mangled-publicly-accessible-__python's...
0
8285
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8475
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7304
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6160
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5621
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4149
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4293
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2709
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1915
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.