views:

569

answers:

3

One of the nice things about COM/ActiveX was the out-of-process EXE. You could have an EXE which exposed methods and properties in a form usable by both other processes, including VBScript and JScript. At the same time the EXE could have its own functionality, related or unrelated to that exposed by its type library.

What is the .NET equivalent?

I have an existing VB6 project which is a scripting language interpreter (using MSScript) and a resource of various tool functions for other scripting languages. It has been suggested that I try converting it to .NET.

Is this going to work, or will I end up splitting the one item into two?

+2  A: 

The .NET correspondence is .NET Remoting for .NET 2.0, and WCF for 3.0+. If you need to communicate with COM objects however, you must create a COM-exposed object instead. There are quite a few tutorials out there for that.

ciscoheat
+1  A: 

There are a few options for this; the most obvious being serviced components; this allows you to host the managed code in COM+ to run it in a separate process, but you need GAC/COM-callable etc.

Marc Gravell
+1  A: 

Enterprise services will allow you to do just that. You can run a COM component as

  • A DLLHost process
  • A serice
  • A inproc library. (This is in the same process as your other code.)

There are numerous examples on the internet about these. What it comes down to is:

  • Decorate your classes that you need to expose to COM with Interfaces
  • Components that you want to host need to be derrived from ServicedComponent
  • Decorate your interfaces with a GuidAttribute (Use a unique Guid)
  • Decorate the interfaces and classes that are exposed to COM with a ComVisible(true) attribute

Hope this helps.

Jeroen Landheer