could not load file or assembly 
Author Message
 could not load file or assembly

I have a vb6 project (standard exe) that makes a method call to a .Net dll.  
This dll (DLL1.dll) makes method calls to a number of other .Net dlls
(DLL2.dll & DLL3.dll)

If I compile my vb6 app into an executable and place exe along with dlls
into a directory C:\MyApp\bin and run the executable from this location, the
method call works as expected.  If I try to run the vb6 project through the
IDE, the method call fails with the message "Could not load file or
assembly..."

Ive copied all of the dlls (dll1.dll, dll2.dll, dll3.dll) into the project
directory but I still get the same error.

any ideas?

tia



Sat, 13 Nov 2010 21:00:00 GMT  
 could not load file or assembly
Hi Terry,

You could try adding a .config file that specifies the codebase, but the
problem is that VB6 is running a temp build, and I'm not sure you can force
the IDE to output the exe and config file (or for that matter copy the
referenced dlls to the executionable path when run from the IDE).
The simplest solution I can think of is just to add your .NET dlls to the
GAC on your development machine.


Quote:
>I have a vb6 project (standard exe) that makes a method call to a .Net dll.
> This dll (DLL1.dll) makes method calls to a number of other .Net dlls
> (DLL2.dll & DLL3.dll)

> If I compile my vb6 app into an executable and place exe along with dlls
> into a directory C:\MyApp\bin and run the executable from this location,
> the
> method call works as expected.  If I try to run the vb6 project through
> the
> IDE, the method call fails with the message "Could not load file or
> assembly..."

> Ive copied all of the dlls (dll1.dll, dll2.dll, dll3.dll) into the project
> directory but I still get the same error.

> any ideas?

> tia



Sat, 13 Nov 2010 21:23:23 GMT  
 could not load file or assembly
Actually, come to think of it, when running from the IDE you are always
pCode, or "interpreted".  As such the probing path and exe would be VB6.exe
and it's path, so you could try adding a vb6.exe.config with the probing
path or just copy the dlls there


Quote:
> Hi Terry,

> You could try adding a .config file that specifies the codebase, but the
> problem is that VB6 is running a temp build, and I'm not sure you can
> force the IDE to output the exe and config file (or for that matter copy
> the referenced dlls to the executionable path when run from the IDE).
> The simplest solution I can think of is just to add your .NET dlls to the
> GAC on your development machine.



>>I have a vb6 project (standard exe) that makes a method call to a .Net
>>dll.
>> This dll (DLL1.dll) makes method calls to a number of other .Net dlls
>> (DLL2.dll & DLL3.dll)

>> If I compile my vb6 app into an executable and place exe along with dlls
>> into a directory C:\MyApp\bin and run the executable from this location,
>> the
>> method call works as expected.  If I try to run the vb6 project through
>> the
>> IDE, the method call fails with the message "Could not load file or
>> assembly..."

>> Ive copied all of the dlls (dll1.dll, dll2.dll, dll3.dll) into the
>> project
>> directory but I still get the same error.

>> any ideas?

>> tia



Sat, 13 Nov 2010 21:31:11 GMT  
 could not load file or assembly
In order to install into GAC the assmblies need to have string names.  The
dlls do not currently have strong names and I do not have source code for
them.  Is this going to be possible?
Quote:

> Hi Terry,

> You could try adding a .config file that specifies the codebase, but the
> problem is that VB6 is running a temp build, and I'm not sure you can force
> the IDE to output the exe and config file (or for that matter copy the
> referenced dlls to the executionable path when run from the IDE).
> The simplest solution I can think of is just to add your .NET dlls to the
> GAC on your development machine.



> >I have a vb6 project (standard exe) that makes a method call to a .Net dll.
> > This dll (DLL1.dll) makes method calls to a number of other .Net dlls
> > (DLL2.dll & DLL3.dll)

> > If I compile my vb6 app into an executable and place exe along with dlls
> > into a directory C:\MyApp\bin and run the executable from this location,
> > the
> > method call works as expected.  If I try to run the vb6 project through
> > the
> > IDE, the method call fails with the message "Could not load file or
> > assembly..."

> > Ive copied all of the dlls (dll1.dll, dll2.dll, dll3.dll) into the project
> > directory but I still get the same error.

> > any ideas?

> > tia



Sat, 13 Nov 2010 21:40:00 GMT  
 could not load file or assembly
Im not sure I understand this.

I have tried copying the dlls to the vb6 dir "C:\Program Files\Microsoft
Visual Studio\VB98" but this makes no difference

Quote:

> Actually, come to think of it, when running from the IDE you are always
> pCode, or "interpreted".  As such the probing path and exe would be VB6.exe
> and it's path, so you could try adding a vb6.exe.config with the probing
> path or just copy the dlls there



> > Hi Terry,

> > You could try adding a .config file that specifies the codebase, but the
> > problem is that VB6 is running a temp build, and I'm not sure you can
> > force the IDE to output the exe and config file (or for that matter copy
> > the referenced dlls to the executionable path when run from the IDE).
> > The simplest solution I can think of is just to add your .NET dlls to the
> > GAC on your development machine.



> >>I have a vb6 project (standard exe) that makes a method call to a .Net
> >>dll.
> >> This dll (DLL1.dll) makes method calls to a number of other .Net dlls
> >> (DLL2.dll & DLL3.dll)

> >> If I compile my vb6 app into an executable and place exe along with dlls
> >> into a directory C:\MyApp\bin and run the executable from this location,
> >> the
> >> method call works as expected.  If I try to run the vb6 project through
> >> the
> >> IDE, the method call fails with the message "Could not load file or
> >> assembly..."

> >> Ive copied all of the dlls (dll1.dll, dll2.dll, dll3.dll) into the
> >> project
> >> directory but I still get the same error.

> >> any ideas?

> >> tia



Sat, 13 Nov 2010 21:44:14 GMT  
 could not load file or assembly


Quote:
> Ive copied all of the dlls (dll1.dll, dll2.dll, dll3.dll) into the project
> directory but I still get the same error.

What do you get if you copy them all into the VB6 directory?

LFS



Sat, 13 Nov 2010 21:49:23 GMT  
 could not load file or assembly
I have tried copying the dlls to the vb6 dir "C:\Program Files\Microsoft
Visual Studio\VB98" but this makes no difference
Quote:


> > Ive copied all of the dlls (dll1.dll, dll2.dll, dll3.dll) into the project
> > directory but I still get the same error.

> What do you get if you copy them all into the VB6 directory?

> LFS



Sat, 13 Nov 2010 21:54:01 GMT  
 could not load file or assembly
If you can't modify the other two assemblies and add strong names to them,
then no you can't add them to the GAC.


Quote:
> In order to install into GAC the assmblies need to have string names.  The
> dlls do not currently have strong names and I do not have source code for
> them.  Is this going to be possible?


>> Hi Terry,

>> You could try adding a .config file that specifies the codebase, but the
>> problem is that VB6 is running a temp build, and I'm not sure you can
>> force
>> the IDE to output the exe and config file (or for that matter copy the
>> referenced dlls to the executionable path when run from the IDE).
>> The simplest solution I can think of is just to add your .NET dlls to the
>> GAC on your development machine.



>> >I have a vb6 project (standard exe) that makes a method call to a .Net
>> >dll.
>> > This dll (DLL1.dll) makes method calls to a number of other .Net dlls
>> > (DLL2.dll & DLL3.dll)

>> > If I compile my vb6 app into an executable and place exe along with
>> > dlls
>> > into a directory C:\MyApp\bin and run the executable from this
>> > location,
>> > the
>> > method call works as expected.  If I try to run the vb6 project through
>> > the
>> > IDE, the method call fails with the message "Could not load file or
>> > assembly..."

>> > Ive copied all of the dlls (dll1.dll, dll2.dll, dll3.dll) into the
>> > project
>> > directory but I still get the same error.

>> > any ideas?

>> > tia



Sat, 13 Nov 2010 22:00:00 GMT  
 could not load file or assembly
Did you try adding a VB6.exe.config file with the codebase entries ?

One other thing you can try, is if you can modify your .NET COM dll, then
have an initializer in that that hard codes the assembly paths if it is a
DEBUG build, e.g:

# If DEBUG Then
 Dim _assembly1 = Assembly.LoadFile("some hard code path")
 Dim _assembly2 = Assembly.LoadFile("some other hard code path")
#End If


Quote:
> Im not sure I understand this.

> I have tried copying the dlls to the vb6 dir "C:\Program Files\Microsoft
> Visual Studio\VB98" but this makes no difference


>> Actually, come to think of it, when running from the IDE you are always
>> pCode, or "interpreted".  As such the probing path and exe would be
>> VB6.exe
>> and it's path, so you could try adding a vb6.exe.config with the probing
>> path or just copy the dlls there



>> > Hi Terry,

>> > You could try adding a .config file that specifies the codebase, but
>> > the
>> > problem is that VB6 is running a temp build, and I'm not sure you can
>> > force the IDE to output the exe and config file (or for that matter
>> > copy
>> > the referenced dlls to the executionable path when run from the IDE).
>> > The simplest solution I can think of is just to add your .NET dlls to
>> > the
>> > GAC on your development machine.



>> >>I have a vb6 project (standard exe) that makes a method call to a .Net
>> >>dll.
>> >> This dll (DLL1.dll) makes method calls to a number of other .Net dlls
>> >> (DLL2.dll & DLL3.dll)

>> >> If I compile my vb6 app into an executable and place exe along with
>> >> dlls
>> >> into a directory C:\MyApp\bin and run the executable from this
>> >> location,
>> >> the
>> >> method call works as expected.  If I try to run the vb6 project
>> >> through
>> >> the
>> >> IDE, the method call fails with the message "Could not load file or
>> >> assembly..."

>> >> Ive copied all of the dlls (dll1.dll, dll2.dll, dll3.dll) into the
>> >> project
>> >> directory but I still get the same error.

>> >> any ideas?

>> >> tia



Sat, 13 Nov 2010 22:05:31 GMT  
 could not load file or assembly
No - Im not sure how to do this.  I will research but I'd appreciate an
example of this
Quote:

> Did you try adding a VB6.exe.config file with the codebase entries ?

> One other thing you can try, is if you can modify your .NET COM dll, then
> have an initializer in that that hard codes the assembly paths if it is a
> DEBUG build, e.g:

> # If DEBUG Then
>  Dim _assembly1 = Assembly.LoadFile("some hard code path")
>  Dim _assembly2 = Assembly.LoadFile("some other hard code path")
> #End If



> > Im not sure I understand this.

> > I have tried copying the dlls to the vb6 dir "C:\Program Files\Microsoft
> > Visual Studio\VB98" but this makes no difference


> >> Actually, come to think of it, when running from the IDE you are always
> >> pCode, or "interpreted".  As such the probing path and exe would be
> >> VB6.exe
> >> and it's path, so you could try adding a vb6.exe.config with the probing
> >> path or just copy the dlls there



> >> > Hi Terry,

> >> > You could try adding a .config file that specifies the codebase, but
> >> > the
> >> > problem is that VB6 is running a temp build, and I'm not sure you can
> >> > force the IDE to output the exe and config file (or for that matter
> >> > copy
> >> > the referenced dlls to the executionable path when run from the IDE).
> >> > The simplest solution I can think of is just to add your .NET dlls to
> >> > the
> >> > GAC on your development machine.



> >> >>I have a vb6 project (standard exe) that makes a method call to a .Net
> >> >>dll.
> >> >> This dll (DLL1.dll) makes method calls to a number of other .Net dlls
> >> >> (DLL2.dll & DLL3.dll)

> >> >> If I compile my vb6 app into an executable and place exe along with
> >> >> dlls
> >> >> into a directory C:\MyApp\bin and run the executable from this
> >> >> location,
> >> >> the
> >> >> method call works as expected.  If I try to run the vb6 project
> >> >> through
> >> >> the
> >> >> IDE, the method call fails with the message "Could not load file or
> >> >> assembly..."

> >> >> Ive copied all of the dlls (dll1.dll, dll2.dll, dll3.dll) into the
> >> >> project
> >> >> directory but I still get the same error.

> >> >> any ideas?

> >> >> tia



Sat, 13 Nov 2010 22:18:00 GMT  
 could not load file or assembly
For which part ?

For the codeBase element in the config file, look up <codeBase> element in
MSDN library.

For the conditional load using #If DEBUG ...it's basically as per the sample
I gave. You need to ensure it gets called first in your .NET  COM dll, such
as fired in a Sub New etc.

One other thing you should do is load Fuslogvw.exe and then run your app to
see if you can identify where it is looking.  That in fact may be the
easiest way.


Quote:
> No - Im not sure how to do this.  I will research but I'd appreciate an
> example of this


>> Did you try adding a VB6.exe.config file with the codebase entries ?

>> One other thing you can try, is if you can modify your .NET COM dll, then
>> have an initializer in that that hard codes the assembly paths if it is a
>> DEBUG build, e.g:

>> # If DEBUG Then
>>  Dim _assembly1 = Assembly.LoadFile("some hard code path")
>>  Dim _assembly2 = Assembly.LoadFile("some other hard code path")
>> #End If



>> > Im not sure I understand this.

>> > I have tried copying the dlls to the vb6 dir "C:\Program
>> > Files\Microsoft
>> > Visual Studio\VB98" but this makes no difference


>> >> Actually, come to think of it, when running from the IDE you are
>> >> always
>> >> pCode, or "interpreted".  As such the probing path and exe would be
>> >> VB6.exe
>> >> and it's path, so you could try adding a vb6.exe.config with the
>> >> probing
>> >> path or just copy the dlls there



>> >> > Hi Terry,

>> >> > You could try adding a .config file that specifies the codebase, but
>> >> > the
>> >> > problem is that VB6 is running a temp build, and I'm not sure you
>> >> > can
>> >> > force the IDE to output the exe and config file (or for that matter
>> >> > copy
>> >> > the referenced dlls to the executionable path when run from the
>> >> > IDE).
>> >> > The simplest solution I can think of is just to add your .NET dlls
>> >> > to
>> >> > the
>> >> > GAC on your development machine.



>> >> >>I have a vb6 project (standard exe) that makes a method call to a
>> >> >>.Net
>> >> >>dll.
>> >> >> This dll (DLL1.dll) makes method calls to a number of other .Net
>> >> >> dlls
>> >> >> (DLL2.dll & DLL3.dll)

>> >> >> If I compile my vb6 app into an executable and place exe along with
>> >> >> dlls
>> >> >> into a directory C:\MyApp\bin and run the executable from this
>> >> >> location,
>> >> >> the
>> >> >> method call works as expected.  If I try to run the vb6 project
>> >> >> through
>> >> >> the
>> >> >> IDE, the method call fails with the message "Could not load file or
>> >> >> assembly..."

>> >> >> Ive copied all of the dlls (dll1.dll, dll2.dll, dll3.dll) into the
>> >> >> project
>> >> >> directory but I still get the same error.

>> >> >> any ideas?

>> >> >> tia



Sat, 13 Nov 2010 22:58:54 GMT  
 could not load file or assembly
Things have suddenly started working!!  Im not entirely what 'fixed' it but I
am now able to debug.  Thanks for all your help
Quote:

> For which part ?

> For the codeBase element in the config file, look up <codeBase> element in
> MSDN library.

> For the conditional load using #If DEBUG ...it's basically as per the sample
> I gave. You need to ensure it gets called first in your .NET  COM dll, such
> as fired in a Sub New etc.

> One other thing you should do is load Fuslogvw.exe and then run your app to
> see if you can identify where it is looking.  That in fact may be the
> easiest way.



> > No - Im not sure how to do this.  I will research but I'd appreciate an
> > example of this


> >> Did you try adding a VB6.exe.config file with the codebase entries ?

> >> One other thing you can try, is if you can modify your .NET COM dll, then
> >> have an initializer in that that hard codes the assembly paths if it is a
> >> DEBUG build, e.g:

> >> # If DEBUG Then
> >>  Dim _assembly1 = Assembly.LoadFile("some hard code path")
> >>  Dim _assembly2 = Assembly.LoadFile("some other hard code path")
> >> #End If



> >> > Im not sure I understand this.

> >> > I have tried copying the dlls to the vb6 dir "C:\Program
> >> > Files\Microsoft
> >> > Visual Studio\VB98" but this makes no difference


> >> >> Actually, come to think of it, when running from the IDE you are
> >> >> always
> >> >> pCode, or "interpreted".  As such the probing path and exe would be
> >> >> VB6.exe
> >> >> and it's path, so you could try adding a vb6.exe.config with the
> >> >> probing
> >> >> path or just copy the dlls there



> >> >> > Hi Terry,

> >> >> > You could try adding a .config file that specifies the codebase, but
> >> >> > the
> >> >> > problem is that VB6 is running a temp build, and I'm not sure you
> >> >> > can
> >> >> > force the IDE to output the exe and config file (or for that matter
> >> >> > copy
> >> >> > the referenced dlls to the executionable path when run from the
> >> >> > IDE).
> >> >> > The simplest solution I can think of is just to add your .NET dlls
> >> >> > to
> >> >> > the
> >> >> > GAC on your development machine.



> >> >> >>I have a vb6 project (standard exe) that makes a method call to a
> >> >> >>.Net
> >> >> >>dll.
> >> >> >> This dll (DLL1.dll) makes method calls to a number of other .Net
> >> >> >> dlls
> >> >> >> (DLL2.dll & DLL3.dll)

> >> >> >> If I compile my vb6 app into an executable and place exe along with
> >> >> >> dlls
> >> >> >> into a directory C:\MyApp\bin and run the executable from this
> >> >> >> location,
> >> >> >> the
> >> >> >> method call works as expected.  If I try to run the vb6 project
> >> >> >> through
> >> >> >> the
> >> >> >> IDE, the method call fails with the message "Could not load file or
> >> >> >> assembly..."

> >> >> >> Ive copied all of the dlls (dll1.dll, dll2.dll, dll3.dll) into the
> >> >> >> project
> >> >> >> directory but I still get the same error.

> >> >> >> any ideas?

> >> >> >> tia



Sat, 13 Nov 2010 23:56:04 GMT  
 could not load file or assembly
no probs. Glad it is working.  If you can, do run Fuslogvw.exe and set it to
log all binding. Then you can see where it is binding to them.


Quote:
> Things have suddenly started working!!  Im not entirely what 'fixed' it
> but I
> am now able to debug.  Thanks for all your help


>> For which part ?

>> For the codeBase element in the config file, look up <codeBase> element
>> in
>> MSDN library.

>> For the conditional load using #If DEBUG ...it's basically as per the
>> sample
>> I gave. You need to ensure it gets called first in your .NET  COM dll,
>> such
>> as fired in a Sub New etc.

>> One other thing you should do is load Fuslogvw.exe and then run your app
>> to
>> see if you can identify where it is looking.  That in fact may be the
>> easiest way.



>> > No - Im not sure how to do this.  I will research but I'd appreciate an
>> > example of this


>> >> Did you try adding a VB6.exe.config file with the codebase entries ?

>> >> One other thing you can try, is if you can modify your .NET COM dll,
>> >> then
>> >> have an initializer in that that hard codes the assembly paths if it
>> >> is a
>> >> DEBUG build, e.g:

>> >> # If DEBUG Then
>> >>  Dim _assembly1 = Assembly.LoadFile("some hard code path")
>> >>  Dim _assembly2 = Assembly.LoadFile("some other hard code path")
>> >> #End If



>> >> > Im not sure I understand this.

>> >> > I have tried copying the dlls to the vb6 dir "C:\Program
>> >> > Files\Microsoft
>> >> > Visual Studio\VB98" but this makes no difference


>> >> >> Actually, come to think of it, when running from the IDE you are
>> >> >> always
>> >> >> pCode, or "interpreted".  As such the probing path and exe would be
>> >> >> VB6.exe
>> >> >> and it's path, so you could try adding a vb6.exe.config with the
>> >> >> probing
>> >> >> path or just copy the dlls there



>> >> >> > Hi Terry,

>> >> >> > You could try adding a .config file that specifies the codebase,
>> >> >> > but
>> >> >> > the
>> >> >> > problem is that VB6 is running a temp build, and I'm not sure you
>> >> >> > can
>> >> >> > force the IDE to output the exe and config file (or for that
>> >> >> > matter
>> >> >> > copy
>> >> >> > the referenced dlls to the executionable path when run from the
>> >> >> > IDE).
>> >> >> > The simplest solution I can think of is just to add your .NET
>> >> >> > dlls
>> >> >> > to
>> >> >> > the
>> >> >> > GAC on your development machine.



>> >> >> >>I have a vb6 project (standard exe) that makes a method call to a
>> >> >> >>.Net
>> >> >> >>dll.
>> >> >> >> This dll (DLL1.dll) makes method calls to a number of other .Net
>> >> >> >> dlls
>> >> >> >> (DLL2.dll & DLL3.dll)

>> >> >> >> If I compile my vb6 app into an executable and place exe along
>> >> >> >> with
>> >> >> >> dlls
>> >> >> >> into a directory C:\MyApp\bin and run the executable from this
>> >> >> >> location,
>> >> >> >> the
>> >> >> >> method call works as expected.  If I try to run the vb6 project
>> >> >> >> through
>> >> >> >> the
>> >> >> >> IDE, the method call fails with the message "Could not load file
>> >> >> >> or
>> >> >> >> assembly..."

>> >> >> >> Ive copied all of the dlls (dll1.dll, dll2.dll, dll3.dll) into
>> >> >> >> the
>> >> >> >> project
>> >> >> >> directory but I still get the same error.

>> >> >> >> any ideas?

>> >> >> >> tia



Sun, 14 Nov 2010 00:40:04 GMT  
 
 [ 13 post ] 

 Relevant Pages 

1. Can not load file or assembly

2. Could not load file or assembly

3. "File or Assembly not found"

4. File or assembly name ADODB, or one of its dependencies, was not found

5. Load Assembly /CreateInstance

6. Load Assembly

7. One or more of the types in the assembly unable to load

8. How do I load and run assemblies dynamically

9. Dynamically loading an assembly?

10. Loading control from assembly

11. Trying to Dunamically Load Assembly via Reflection

12. Loading an assembly at runtime

 

 
Powered by phpBB® Forum Software