468,248 Members | 1,528 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,248 developers. It's quick & easy.

Remoting, first attempt and 'type or namespace xxx could not be found'

I know this is a really simple thing but it is not intuitively obvious on
how to do this the first time.

I've created a remote server which lives in an EXE. This compiles.

I've create a client of the remote server which fails to compile due to a
failure of the 'using' line that would import the server class's definition.
I can't figure out how to add the server as a reference because the server
is an EXE, not a DLL.

So - how do I import the class information from my server into my client?
=======
Richard Lewis Haggard
Nov 16 '05 #1
2 1058
Hi,
VS.Net does not allow you to make a reference to .exe. But the c# command
line compiler does.

Also, this is not good approach at all. You have to consider a different
one, I'll order them in the way I do prefer it (1-st one is less
recommended, etc.):

1. Put your remote class in a separate assembly (dll), and reference to it
both from client and server.
2. Put your remote class in a separate assembly. Reference it from the
server. Use soapsuds.exe to extract the metadata from that assembly, and
reference the result from the client. This way you do not ship your
original class with the client. There a lot of problems with soapsuds.exe,
so even it is a possibility, I would not recommend using it.

The next 2 approaches are highly recommended:

3. Create and abstract class, which inherits from MarshalByRefferenceObject
and contains all the methods you are going to use with remoting. Then make
your remote class inherit from it, and reference it from the server. At the
client, reference the abstract class assembly only, and your client will
cast the remoted object to the abstract class. And you will have all needed
to invoke the remote object. And you are not going to ship your code with
the client.
You may take a look to Allen Anderson's article for this:
http://www.glacialcomponents.com/Art...D=RemoteObject

4. This is my favorite. It is very similar to the previous one, but instead
of using abstract class, use interfaces. In my opinion, this is better,
because of the limitations you have with abstract classes (no multiple
inheritances). And is more flexible and scalable.

Also, I'd suggest that you use framework.remoting newsgroup for remoting
related questions. There are a lot of good examples and answers already.
Use groups.google search, or microsoft site for searching.

Hope that helps
Sunny

"Richard Lewis Haggard" <HaggardAtWorldDotStdDotCom> wrote:
I know this is a really simple thing but it is not intuitively obvious on
how to do this the first time.

I've created a remote server which lives in an EXE. This compiles.

I've create a client of the remote server which fails to compile due to a
failure of the 'using' line that would import the server class's
definition. I can't figure out how to add the server as a reference
because the server is an EXE, not a DLL.

So - how do I import the class information from my server into my client?
=======
Richard Lewis Haggard


Nov 16 '05 #2
Excellent response! I do so thank you for your quick, timely and informative
response.
======
"I just got a new car for my wife. Wish I could make a trade like that every
day." - Henny Youngman.
Richard Lewis Haggard

"Sunny" <su******@icebergwireless.com> wrote in message
news:ul**************@TK2MSFTNGP09.phx.gbl...
Hi,
VS.Net does not allow you to make a reference to .exe. But the c# command
line compiler does.

Also, this is not good approach at all. You have to consider a different
one, I'll order them in the way I do prefer it (1-st one is less
recommended, etc.):

1. Put your remote class in a separate assembly (dll), and reference to it
both from client and server.
2. Put your remote class in a separate assembly. Reference it from the
server. Use soapsuds.exe to extract the metadata from that assembly, and
reference the result from the client. This way you do not ship your
original class with the client. There a lot of problems with soapsuds.exe,
so even it is a possibility, I would not recommend using it.

The next 2 approaches are highly recommended:

3. Create and abstract class, which inherits from MarshalByRefferenceObject and contains all the methods you are going to use with remoting. Then make
your remote class inherit from it, and reference it from the server. At the client, reference the abstract class assembly only, and your client will
cast the remoted object to the abstract class. And you will have all needed to invoke the remote object. And you are not going to ship your code with
the client.
You may take a look to Allen Anderson's article for this:
http://www.glacialcomponents.com/Art...D=RemoteObject

4. This is my favorite. It is very similar to the previous one, but instead of using abstract class, use interfaces. In my opinion, this is better,
because of the limitations you have with abstract classes (no multiple
inheritances). And is more flexible and scalable.

Also, I'd suggest that you use framework.remoting newsgroup for remoting
related questions. There are a lot of good examples and answers already.
Use groups.google search, or microsoft site for searching.

Hope that helps
Sunny

"Richard Lewis Haggard" <HaggardAtWorldDotStdDotCom> wrote:
I know this is a really simple thing but it is not intuitively obvious on how to do this the first time.

I've created a remote server which lives in an EXE. This compiles.

I've create a client of the remote server which fails to compile due to a failure of the 'using' line that would import the server class's
definition. I can't figure out how to add the server as a reference
because the server is an EXE, not a DLL.

So - how do I import the class information from my server into my client? =======
Richard Lewis Haggard

Nov 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.