473,700 Members | 2,669 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 1422
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
1789
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
3089
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
1429
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
3041
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
2138
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
1600
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
1158
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
2642
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
3129
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
1663
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
8639
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,...
0
9203
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
9058
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8952
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
5895
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
4395
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
4649
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3082
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
3
2018
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.