vb.netcomout-of-process

Reference another VB.NET exe that has COM visible TRUE


I would like to mimic the behaviour of a VB6-Active-X-Exe.

To do that, I have created a new project and set its settings to "COM Visible=True".

I can now add this .exe to my main application, and I can call it, call functions in that .exe, etc.

However, it is not really out of process, I think.

I would therefore like to investigate more about such an .exe's behaviour. But I did not find any official documentation on it.

Can somebody tell me where to find more info?

Thank you!


Solution

  • Out-of-process COM servers (ActiveX EXE's) are not as easy to create with VB.NET as they were with VB6. When you reference a .NET executable (as a .NET assembly reference, not as a COM reference) from another .NET project, it always treats it as in in-process library. The .NET Framework has no direct equivalent to COM's out-of-process servers. Typically, in such scenarios, it is recommended that you create a WCF service, a web service, or use .NET remoting. WCF services are preferred since they use the most modern technology of the three.

    However, since .NET supports COM interoperability, it is technically possible to create a .NET executable which can be registered as a out-of-process COM server. Then, when another .NET project references it via COM (rather than as a .NET assembly reference) it will run out-of-process. Microsoft provides an example of how to do that here.

    However, if you don't need it to be COM (so that it can be used by non-.NET applications), I would recommend that you go the pure .NET WCF service route.