assembly and reuse

T

Tony Johansson

Hello!

An assembly can be either an executable with extension exe or a dynamic
library with extension dll.

I just wonder if I have an exe file with a method called Foo is it then
possible to reuse this method Foo in another
exe file or dll file or is this only possible when having a dll class
library ?

I do know that the dll is used just for this to reuse for example a method.

//Tony
 
P

Peter Duniho

Tony said:
Hello!

An assembly can be either an executable with extension exe or a dynamic
library with extension dll.

I just wonder if I have an exe file with a method called Foo is it then
possible to reuse this method Foo in another
exe file or dll file or is this only possible when having a dll class
library ? [...]

To use a type and its members found in a DLL, you have to add the DLL
assembly as a reference to your project.

What happened when you tried the same with an EXE assembly?

After all, if you want to know whether something will work, one of the
easiest, most direct ways to find out the answer is to try it.

Pete
 
T

Tony Johansson

Peter Duniho said:
Tony said:
Hello!

An assembly can be either an executable with extension exe or a dynamic
library with extension dll.

I just wonder if I have an exe file with a method called Foo is it then
possible to reuse this method Foo in another
exe file or dll file or is this only possible when having a dll class
library ? [...]

To use a type and its members found in a DLL, you have to add the DLL
assembly as a reference to your project.

What happened when you tried the same with an EXE assembly?

After all, if you want to know whether something will work, one of the
easiest, most direct ways to find out the answer is to try it.

Pete

Hi

The reason I asked is because in a text it says
"A PE file with extension exe can be executed as is simply by executing it,
but it can also be used as a component for reuse
in other program."

This must be totaly wrong because only dll can be used for reuse as
component
Is it possible that they mean something else.

//Tony
 
J

Jesse Houwing

* Tony Johansson wrote, On 15-1-2010 11:46:
Peter Duniho said:
Tony said:
Hello!

An assembly can be either an executable with extension exe or a dynamic
library with extension dll.

I just wonder if I have an exe file with a method called Foo is it then
possible to reuse this method Foo in another
exe file or dll file or is this only possible when having a dll class
library ? [...]

To use a type and its members found in a DLL, you have to add the DLL
assembly as a reference to your project.

What happened when you tried the same with an EXE assembly?

After all, if you want to know whether something will work, one of the
easiest, most direct ways to find out the answer is to try it.

Pete

Hi

The reason I asked is because in a text it says
"A PE file with extension exe can be executed as is simply by executing it,
but it can also be used as a component for reuse
in other program."

This must be totaly wrong because only dll can be used for reuse as
component
Is it possible that they mean something else.

Well you're wrong there. A .NET exe is nothing more than a regular
assembly with some additional sugar to point to the entry method.

To try for yourself: create a blank solution, add two winforms apps, now
add a reference from one app to the other.

It's darn easy to show forms from app2 in app one, without having to
place them in a Class Library for re-use.

Agreed, it's 'better' or at least easier to maintain if the forms are
placed in a third library which is referenced from both apps, but there
is no actual need to do so.

Jesse
 
T

Tony Johansson

Jesse Houwing said:
* Tony Johansson wrote, On 15-1-2010 11:46:
Peter Duniho said:
Tony Johansson wrote:
Hello!

An assembly can be either an executable with extension exe or a dynamic
library with extension dll.

I just wonder if I have an exe file with a method called Foo is it then
possible to reuse this method Foo in another
exe file or dll file or is this only possible when having a dll class
library ? [...]

To use a type and its members found in a DLL, you have to add the DLL
assembly as a reference to your project.

What happened when you tried the same with an EXE assembly?

After all, if you want to know whether something will work, one of the
easiest, most direct ways to find out the answer is to try it.

Pete

Hi

The reason I asked is because in a text it says
"A PE file with extension exe can be executed as is simply by executing
it,
but it can also be used as a component for reuse
in other program."

This must be totaly wrong because only dll can be used for reuse as
component
Is it possible that they mean something else.

Well you're wrong there. A .NET exe is nothing more than a regular
assembly with some additional sugar to point to the entry method.

To try for yourself: create a blank solution, add two winforms apps, now
add a reference from one app to the other.

It's darn easy to show forms from app2 in app one, without having to place
them in a Class Library for re-use.

Agreed, it's 'better' or at least easier to maintain if the forms are
placed in a third library which is referenced from both apps, but there is
no actual need to do so.

Jesse

Hi!

I have now added two windows app project to an empty solution.
The first project is called WindowsApplication4 with one instance method
called Foo4 and the second is called WindowsApplication5 with an instance
method called Foo5
In the References I had added WindowsApplication5.
So I just for testing want to be able to call Foo5 from WindowsApplication4
?

Now to my question how is it possible as you write to call a method in the
WindowsApplication5 from
WindowsApplication4 ?

Can you specify what I must do to accomplish this.

//Tony
 
T

Tony Johansson

Tony Johansson said:
Jesse Houwing said:
* Tony Johansson wrote, On 15-1-2010 11:46:
"Peter Duniho"<[email protected]> skrev i meddelandet
Tony Johansson wrote:
Hello!

An assembly can be either an executable with extension exe or a
dynamic
library with extension dll.

I just wonder if I have an exe file with a method called Foo is it
then
possible to reuse this method Foo in another
exe file or dll file or is this only possible when having a dll class
library ? [...]

To use a type and its members found in a DLL, you have to add the DLL
assembly as a reference to your project.

What happened when you tried the same with an EXE assembly?

After all, if you want to know whether something will work, one of the
easiest, most direct ways to find out the answer is to try it.

Pete

Hi

The reason I asked is because in a text it says
"A PE file with extension exe can be executed as is simply by executing
it,
but it can also be used as a component for reuse
in other program."

This must be totaly wrong because only dll can be used for reuse as
component
Is it possible that they mean something else.

Well you're wrong there. A .NET exe is nothing more than a regular
assembly with some additional sugar to point to the entry method.

To try for yourself: create a blank solution, add two winforms apps, now
add a reference from one app to the other.

It's darn easy to show forms from app2 in app one, without having to
place them in a Class Library for re-use.

Agreed, it's 'better' or at least easier to maintain if the forms are
placed in a third library which is referenced from both apps, but there
is no actual need to do so.

Jesse

Hi!

I have now added two windows app project to an empty solution.
The first project is called WindowsApplication4 with one instance method
called Foo4 and the second is called WindowsApplication5 with an instance
method called Foo5
In the References I had added WindowsApplication5.
So I just for testing want to be able to call Foo5 from
WindowsApplication4 ?

Now to my question how is it possible as you write to call a method in the
WindowsApplication5 from
WindowsApplication4 ?

Can you specify what I must do to accomplish this.

//Tony

I did a type error so reference a method in a win app exe from another win
app project work good.

//Tony
 
T

Tony Johansson

Tony Johansson said:
Jesse Houwing said:
* Tony Johansson wrote, On 15-1-2010 11:46:
"Peter Duniho"<[email protected]> skrev i meddelandet
Tony Johansson wrote:
Hello!

An assembly can be either an executable with extension exe or a
dynamic
library with extension dll.

I just wonder if I have an exe file with a method called Foo is it
then
possible to reuse this method Foo in another
exe file or dll file or is this only possible when having a dll class
library ? [...]

To use a type and its members found in a DLL, you have to add the DLL
assembly as a reference to your project.

What happened when you tried the same with an EXE assembly?

After all, if you want to know whether something will work, one of the
easiest, most direct ways to find out the answer is to try it.

Pete

Hi

The reason I asked is because in a text it says
"A PE file with extension exe can be executed as is simply by executing
it,
but it can also be used as a component for reuse
in other program."

This must be totaly wrong because only dll can be used for reuse as
component
Is it possible that they mean something else.

Well you're wrong there. A .NET exe is nothing more than a regular
assembly with some additional sugar to point to the entry method.

To try for yourself: create a blank solution, add two winforms apps, now
add a reference from one app to the other.

It's darn easy to show forms from app2 in app one, without having to
place them in a Class Library for re-use.

Agreed, it's 'better' or at least easier to maintain if the forms are
placed in a third library which is referenced from both apps, but there
is no actual need to do so.

Jesse

Hi!

I have now added two windows app project to an empty solution.
The first project is called WindowsApplication4 with one instance method
called Foo4 and the second is called WindowsApplication5 with an instance
method called Foo5
In the References I had added WindowsApplication5.
So I just for testing want to be able to call Foo5 from
WindowsApplication4 ?

Now to my question how is it possible as you write to call a method in the
WindowsApplication5 from
WindowsApplication4 ?

Can you specify what I must do to accomplish this.

//Tony

Hi

I did some type errror it works now.
//Tony
 
P

Peter Duniho

Tony said:
The reason I asked is because in a text it says
"A PE file with extension exe can be executed as is simply by executing it,
but it can also be used as a component for reuse
in other program."

This must be totaly wrong because only dll can be used for reuse as
component
Is it possible that they mean something else.

No. And I'm a bit puzzled by your apparent habit of using the word
"wrong" to describe something that is not wrong (the above is not the
first time). I realize English is probably not your native language,
but you may want to take some time and look more closely at the
definition of the word "wrong".

Pete
 

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

Similar Threads


Top