473,750 Members | 2,270 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Loading referenced DLL's

Dear colleagues,
i'm new in the .net programming and hope you can help me.

I have two classes: Employee and Address
The Employee class has a reference to the Address and imports them on the
top.

I can test it locally, and it works but now I wants to load the Employee-DLL
with this code:

Public Function executeDllMetho d(ByVal DllPath As String, ByVal ClassName As
String, ByVal DLLMethod As String) As Object
Dim myAssembly As Assembly
myAssembly = Assembly.LoadFr om(DllPath)

Dim myMethod As MethodInfo
Dim myType As Type
myType = myAssembly.GetT ype(ClassName)
'MsgBox(DLLMeth od.ToString)
myMethod = myType.GetMetho d(DLLMethod)

Dim o As New Object
o = Activator.Creat eInstance(myTyp e)
Dim result As Object
result = myMethod.Invoke (o, Nothing)
Return result
But it does not work. I receive only an error, that the Address-DLL cannot
be loaded (File not found)
When I register the Address-DLL in the GAC it works.

Do you know a solution without using the GAC or where's/what's the problem?

Thanks
Patrick



Jan 25 '06 #1
2 1425
Question, does DllPath contains full path to dll location?
FileNotFoundExc eption makes me think that there are no assembly on
<DllPath>.

<APPFOLDER> - application folder
<ASSEMBLY_NAM E> - assembly name
<CULTURE> - assembly culture info

You should place your assembly in <APPFOLDER> or
<APPFOLDER>\<AS SEMBLY_NAME> directory

if assembly has culture info then loader shall try to find it in the
following locations
<APPFOLDER>\<CU LTURE>
<APPFOLDER>\<AS SEMBLY_NAME>\<C ULTURE>

Jan 25 '06 #2


Try using the Assembly FullName

Es:

Dim testAssembly As AssemblyName =
System.Reflecti on.AssemblyName .GetAssemblyNam e(AssemblyName & ".dll")

asm = [Assembly].Load(testAssem bly.FullName)


"Patrick Ravi-Pinto" <Nu************ **@hotmail.com> escribió en el mensaje
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Dear colleagues,
i'm new in the .net programming and hope you can help me.

I have two classes: Employee and Address
The Employee class has a reference to the Address and imports them on the
top.

I can test it locally, and it works but now I wants to load the
Employee-DLL with this code:

Public Function executeDllMetho d(ByVal DllPath As String, ByVal ClassName
As String, ByVal DLLMethod As String) As Object
Dim myAssembly As Assembly
myAssembly = Assembly.LoadFr om(DllPath)

Dim myMethod As MethodInfo
Dim myType As Type
myType = myAssembly.GetT ype(ClassName)
'MsgBox(DLLMeth od.ToString)
myMethod = myType.GetMetho d(DLLMethod)

Dim o As New Object
o = Activator.Creat eInstance(myTyp e)
Dim result As Object
result = myMethod.Invoke (o, Nothing)
Return result
But it does not work. I receive only an error, that the Address-DLL cannot
be loaded (File not found)
When I register the Address-DLL in the GAC it works.

Do you know a solution without using the GAC or where's/what's the
problem?

Thanks
Patrick


Feb 10 '06 #3

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

Similar topics

5
1794
by: Nick Malik | last post by:
reposting to a wider audience "Nick Malik" <nickmalik@hotmail.nospam.com> wrote in message news:WYONc.203854$XM6.119642@attbi_s53... > My turn to ask a question > > I am working on a plug-in for Sharepoint that will allow a developer to add > workflow rules. One of the rules will inform the adapter that it should > load a DLL that the developer writes, find a method that matches a
1
3118
by: Martin Schneider | last post by:
Hi! I created a database form with a simple Form_Load procedure and a simple Form_resize procedure. Both work fine on one machine. On a second machine I get a "Error loading DLL" on these procedures, even if i comment out all the code inside these procedures. This is very weird! On a third machine, everything works fine again.
4
1431
by: Nick Malik | last post by:
My turn to ask a question I am working on a plug-in for Sharepoint that will allow a developer to add workflow rules. One of the rules will inform the adapter that it should load a DLL that the developer writes, find a method that matches a particular interface, and call it. I know, in general, I should be looking at the reflection classes. Does anyone have any design advice for me, or good working examples that would serve as a...
7
3044
by: Ollie Riches | last post by:
I am trying to dynamically load an assembly that has a reference to 'Interop.WMEncoderLib.dll' which is a PIA to the windows media player DRM components. When I run the code from a console application it works perfectly fine, but when the assembly containing the reference is load from a windows service an exception is thrown with the following message: "File or assembly name Interop.WMEncoderLib, or one of its dependencies, was not...
2
2142
by: NGM | last post by:
Hello All I have a unmanaged C++ DLL, which has been wrapped up with a manged C++ DLL. When i refer to this managed DLL in Windows form based applications it works out fine. But when i refer to the the same managed C++ DLL in ASP.Net application. ngmujumdar@hotmail.com/ amar_a_k@yahhoo.co NG
2
1601
by: Sri Prasad Tadimalla | last post by:
Is there a way to defer loading of a DLL until it is referenced by a method? Our product ships optional DLLs and we want to avoid writing wrapper classes to isolate calls to those DLLs. This is becoming cumbersome as we develop more licensed components. Perhaps there is a way to protect this code in some kind of tag? Thanks, Prasad
1
1160
by: Notachance | last post by:
I've written a .NET web application that interacts with a third-party COM DLL. The target server already runs a legacy ASP application that interacts with an older version of the same COM DLL. You can probably see where this is heading... The .NET app behaves fine on my development machine, but when deployed to the live box the app loads the wrong (old) DLL, not the new one, even though it's been referenced, copy local = true and the new...
2
2645
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...
8
3135
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
1665
by: wojtowicz.maciej | last post by:
Hello, We have asp.net application: .net / 200 000 loc and about 200 000 loc in orbital projects (referenced to website as projects (not as dlls)). Compiling application time is "normal". Full recompile lasts about 40 minutes but when we make changes in particular projects or website it's not so painfull.
0
9000
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9577
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...
0
9256
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
8260
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
6804
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
6081
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
4713
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...
2
2804
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2225
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.