473,626 Members | 3,947 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Loading private assemblies from a subdirectory

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.Creat eInstanceFromAn dUnwrap method, it throws an exception,
saying "File or assembly name ImportControlle r.dll, or one of its
dependencies, was not found"

Let me be more specific by giving you some code-snippets....

*************** *************

/*
This is where I'm trying to create a new AppDomain. 'subfolder' is a
subfolder name (not full path) of the directory where the test harness
exe resides. exePath is the directory of the test harness exe.
ImportControlle r.dll is the .NET assembly dll which I know resides in
the subfolder
Client.ImportCo ntroller.Import Control is a type defined in that
assembly
The subfolder not only contains ImportControlle r.dll, but also the
other dlls it references
*/
AppDomainSetup setup = new AppDomainSetup( );
string exePath =
Path.GetDirecto ryName(Assembly .GetEntryAssemb ly().Location);
setup.Applicati onBase = exePath;
setup.PrivateBi nPath = subfolder;
AppDomain appDomain = AppDomain.Creat eDomain(subfold er, null, setup);
object ic =
appDomain.Creat eInstanceFromAn dUnwrap("Import Controller.dll" ,
"Client.ImportC ontroller.Impor tControl");

*************** *************

When I run this up, I get an exception...its message being "File or
assembly name ImportControlle r.dll, or one of its dependencies, was not
found."

This is what I see in the Assembly Binder Log Entry

*************** *************

*** Assembly Binder Log Entry (4/7/2006 @ 7:08:43 PM) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file
specified.

Assembly manager loaded from:
C:\WINDOWS\Micr osoft.NET\Frame work\v1.1.4322\ fusion.dll
Running under executable
D:\Project\Clie nt\Import\TestH arness\bin\Debu g\TestHarness.e xe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: Where-ref bind. Location =
D:\Project\Clie nt\Import\TestH arness\bin\Debu g\ImportControl ler.dll
LOG: Appbase = D:\Project\Clie nt\Import\TestH arness\bin\Debu g
LOG: Initial PrivatePath = Current
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : (Unknown).
===

LOG: Processing DEVPATH.
LOG: Attempting application configuration file download.
LOG: Download of application configuration file was attempted from
file:///D:/Project/Client/Import/TestHarness/bin/Debug/TestHarness.exe .config.
LOG: Application configuration file does not exist.
LOG: Policy not being applied to reference at this time (private,
custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL
file:///D:/Project/ClientImport/TestHarness/bin/Debug/ImportControlle r.dll.
LOG: All probing URLs attempted and failed.

*************** *************

It seems to show that the PrivatePath is set to 'Current' which is the
correct subfolder name, yet it does not try to download the dll from
that location.
I'm probably being a complete dunce, or just haven't properly
understood how AppDomains work, but if you could shed some light on
this situation of mine I would really really appreciate it.

Many thanks in advance....

Ratul

Apr 7 '06 #1
0 1723

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

Similar topics

9
4475
by: Ender | last post by:
I have an application that I would like third party developers to be able to create Plug-ins that will be dynamically loaded into our application to extend functionality. I have utilized the "Let Users Add Functionality to Your .NET Applications with Macros and Plug-Ins" article at MSDN for the dynamic loading of DLLs http://msdn.microsoft.com/msdnmag/issues/03/10/Plug-Ins/default.aspx
0
1322
by: Verane | last post by:
Hi all, I am working with C# and Visual studio 2003. What I want to do is the following : I have 3 assemblies, let call them A.exe, B.dll and C.dll. I want to dynamically load B and C when A is loaded. B and C are statically referencing A. Those three projects are in the same solution called mySolution.
2
2926
by: Lucas Fletcher | last post by:
Hello, I was wondering how I can reference assemblies from web.config files residing in subdirectories without having to create a new project for each web.config-containing subdirectory? I would like to use an HttpModule, but only for files in a particular directory, so I add a web.config file containing this: <?xml version="1.0" encoding="utf-8" ?>
4
4202
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 our application framework assembly. It has no life of its own - it's designed to provide components that are glued together by another, main application assembly - let us call it APP. Thus, APP uses APPFX, and APP is registered with ASP.NET as a...
4
2480
by: BrianS | last post by:
What is the best strategy for dynamic loading private assemblies in asp.net? I understand, and have confirmed, that any dll placed in the app's /bin dir will get loaded on startup. This is not desirable. I have a web service that, based on an input parameter, dynamically loads A, B or C library. I also understand that an separate AppDomain is needed to explicitly unload the Assembly. No other apps will use these assemblies. Do I need...
2
2635
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 recurse into an assembly to discover the referenced assemblies without actually loading the root assembly where I start the load? For example: assembly 1 contains references to assembly 1_1 and assembly 1_2 assembly 1_1 contains reference to...
0
2312
by: npthomson | last post by:
Hi all, This could get a bit complicated but I'll try to be as clear as possible. I've written an application that discovers plugins at runtime using reflection from a subdirectory of the application, eg: In the directory the application is installed to: \application.exe \plugins\plugin1.dll
1
1985
by: icfai | last post by:
hi friends.... I have got a problem regarding loading of multiple assemblies, actually its required for an editor which implements the intellisenseas in vb or dotnet. for that it is required to load that assembly whose sub-classes are required to be loaded into the list box after pressing dot. for example in the code given below i have given the path of System.dll assembly file, now all the sub class of System.Data are automatically...
8
3125
by: =?Utf-8?B?TWFyaw==?= | last post by:
We've got a wierd failure happening on just one machine. One part of our product uses a 3rd party search implementation (dtSearch). DtSearch has a native core (dten600.dll), late-bound, and a managed wrapper (dtSearchNetApi2.dll). For reasons unknown our build and msi packaging process includes dtSearchNetApi2.dll but not dten600.dll in all packages, as well as a couple of assemblies that reference it, even though they are not used by...
0
8705
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8365
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
8505
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7196
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...
0
5574
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
4092
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
4198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2626
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
2
1511
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.