Assemlby.LoadForm() exception

G

Guest

I'm trying a very simple test to load an
assembly(dll) with the Late binding .
Hier is the Code i have in my application :
-----Code ----------
try
{
Assembly assemblyInstance =
Assembly.LoadFrom(@"C:\Data\Dlls\Myfunctions.dll");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
-------------code end--------

This is throwing the following exception:
Could not load file or assembly ' C:\Data\Dlls\Myfunctions.dll' or one of
its dependencies. The module was expected to contain an assembly manifest.

The DLL i am trying to use is a simple dll that was created with another
tool ( Labwindows CVI from national Instruments). I muss notify that it
walks , when i try the early Binding with the same DLL .
Can somebody help me ?
Thanks.
 
S

scott blood

This seems to be something to do with Un-Managed code. Unless you
explicitly specify it, your code will not be able to use umanaged code and
afaik Assembly.LoadFrom requires a managed DLL whether or not you specify
the use of unmanaged code.

Regards
Scott Blood
C# Developer
 
G

Guest

hi scott,
thank you for your answer. but please could you tell me how i can specify
that my dll is an unmanaged code ? i tried to find how to do it without
succes.
Thanks.
 
S

scott blood

Hello,

Rather than me writing a full paragraph on how to interact with unmanaged
code you can have a look at this article, which pretty much explains
everything.


to specify that your application is allowed to use unmanaged code you
 
G

Guest

Hello scott,
Thank you for your answer and for the article, but the problem is still
remaning because the article is talking about how to call Unmanaged Code
using the Early Binding, and i know how it walks . My problem is now , How
can i call Unmanaged Code using the Late Binding ???? I hope you can help me
..
Regards
Entwickler.
 
W

Willy Denoyette [MVP]

Please tell us what you mean by calling unmanaged code using late binding.
There is no such thing like "late binding" when calling unmanaged code
unless you are talking about calling native code through COM interop, but
that's a different matter.

Willy.




| Hello scott,
| Thank you for your answer and for the article, but the problem is still
| remaning because the article is talking about how to call Unmanaged Code
| using the Early Binding, and i know how it walks . My problem is now ,
How
| can i call Unmanaged Code using the Late Binding ???? I hope you can help
me
| .
| Regards
| Entwickler.
|
|
| "scott blood" wrote:
|
| > Hello
| >
| > Rather than me writing a full paragraph explaining how to use unmanaged
| > code, you could have a look at this article.
| >
| > http://www.findarticles.com/p/articles/mi_zddvs/is_200502/ai_n9522544
| >
| > If you are still unsure after reading this , please post back and i will
try
| > and post some easy to understand examples.
| >
| > Regards
| > Scott Blood
| > C# Developer
| >
| > | > > hi scott,
| > > thank you for your answer. but please could you tell me how i can
specify
| > > that my dll is an unmanaged code ? i tried to find how to do it
without
| > > succes.
| > > Thanks.
| > >
| > > "scott blood" wrote:
| > >
| > >> This seems to be something to do with Un-Managed code. Unless you
| > >> explicitly specify it, your code will not be able to use umanaged
code
| > >> and
| > >> afaik Assembly.LoadFrom requires a managed DLL whether or not you
specify
| > >> the use of unmanaged code.
| > >>
| > >> Regards
| > >> Scott Blood
| > >> C# Developer
| > >>
| > >> | > >> > I'm trying a very simple test to load an
| > >> > assembly(dll) with the Late binding .
| > >> > Hier is the Code i have in my application :
| > >> > -----Code ----------
| > >> > try
| > >> > {
| > >> > Assembly assemblyInstance =
| > >> > Assembly.LoadFrom(@"C:\Data\Dlls\Myfunctions.dll");
| > >> > }
| > >> > }
| > >> > catch (Exception ex)
| > >> > {
| > >> > MessageBox.Show(ex.Message);
| > >> > }
| > >> > -------------code end--------
| > >> >
| > >> > This is throwing the following exception:
| > >> > Could not load file or assembly ' C:\Data\Dlls\Myfunctions.dll' or
one
| > >> > of
| > >> > its dependencies. The module was expected to contain an assembly
| > >> > manifest.
| > >> >
| > >> > The DLL i am trying to use is a simple dll that was created with
| > >> > another
| > >> > tool ( Labwindows CVI from national Instruments). I muss notify
that
| > >> > it
| > >> > walks , when i try the early Binding with the same DLL .
| > >> > Can somebody help me ?
| > >> > Thanks.
| > >> >
| > >> >
| > >>
| > >>
| > >>
| >
| >
| >
 
S

scott blood

I have posted a possible solution in your other post further up in the
newgsgroup

Regards
Scott Blood
C# DEveloper
 
W

Willy Denoyette [MVP]

My post?

Willy.

|I have posted a possible solution in your other post further up in the
| newgsgroup
|
| Regards
| Scott Blood
| C# DEveloper
|
| | > Please tell us what you mean by calling unmanaged code using late
binding.
| > There is no such thing like "late binding" when calling unmanaged code
| > unless you are talking about calling native code through COM interop,
but
| > that's a different matter.
| >
| > Willy.
| >
| >
| >
| >
| > | > | Hello scott,
| > | Thank you for your answer and for the article, but the problem is
still
| > | remaning because the article is talking about how to call Unmanaged
Code
| > | using the Early Binding, and i know how it walks . My problem is now
,
| > How
| > | can i call Unmanaged Code using the Late Binding ???? I hope you can
| > help
| > me
| > | .
| > | Regards
| > | Entwickler.
| > |
| > |
| > | "scott blood" wrote:
| > |
| > | > Hello
| > | >
| > | > Rather than me writing a full paragraph explaining how to use
| > unmanaged
| > | > code, you could have a look at this article.
| > | >
| > | >
http://www.findarticles.com/p/articles/mi_zddvs/is_200502/ai_n9522544
| > | >
| > | > If you are still unsure after reading this , please post back and i
| > will
| > try
| > | > and post some easy to understand examples.
| > | >
| > | > Regards
| > | > Scott Blood
| > | > C# Developer
| > | >
| > | > | > | > > hi scott,
| > | > > thank you for your answer. but please could you tell me how i can
| > specify
| > | > > that my dll is an unmanaged code ? i tried to find how to do it
| > without
| > | > > succes.
| > | > > Thanks.
| > | > >
| > | > > "scott blood" wrote:
| > | > >
| > | > >> This seems to be something to do with Un-Managed code. Unless
you
| > | > >> explicitly specify it, your code will not be able to use umanaged
| > code
| > | > >> and
| > | > >> afaik Assembly.LoadFrom requires a managed DLL whether or not you
| > specify
| > | > >> the use of unmanaged code.
| > | > >>
| > | > >> Regards
| > | > >> Scott Blood
| > | > >> C# Developer
| > | > >>
| > message
| > | > >> | > | > >> > I'm trying a very simple test to load an
| > | > >> > assembly(dll) with the Late binding .
| > | > >> > Hier is the Code i have in my application :
| > | > >> > -----Code ----------
| > | > >> > try
| > | > >> > {
| > | > >> > Assembly assemblyInstance =
| > | > >> > Assembly.LoadFrom(@"C:\Data\Dlls\Myfunctions.dll");
| > | > >> > }
| > | > >> > }
| > | > >> > catch (Exception ex)
| > | > >> > {
| > | > >> > MessageBox.Show(ex.Message);
| > | > >> > }
| > | > >> > -------------code end--------
| > | > >> >
| > | > >> > This is throwing the following exception:
| > | > >> > Could not load file or assembly ' C:\Data\Dlls\Myfunctions.dll'
| > or
| > one
| > | > >> > of
| > | > >> > its dependencies. The module was expected to contain an
assembly
| > | > >> > manifest.
| > | > >> >
| > | > >> > The DLL i am trying to use is a simple dll that was created
with
| > | > >> > another
| > | > >> > tool ( Labwindows CVI from national Instruments). I muss
notify
| > that
| > | > >> > it
| > | > >> > walks , when i try the early Binding with the same DLL .
| > | > >> > Can somebody help me ?
| > | > >> > Thanks.
| > | > >> >
| > | > >> >
| > | > >>
| > | > >>
| > | > >>
| > | >
| > | >
| > | >
| >
| >
|
|
 
S

scott blood

Willy,

Not your post, the origonal post by Entwickler.

Sorry my news reader is messed up today, its not replying to the correct
posts.

Regards
Scott Blood
C# Developer
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top