<p>I am trying to implement an "out of proc" COM server written in C#. How do I do this?</p>

<p>I need the C# code to be "out of proc" from my main C++ application, because I cannot load the .NET runtime into my main process space </p>

<p><em>WHY?:</em><br> 
My C++ code is in a DLL that is loaded into many different customer EXE's, some of which use different versions of the .NET runtime. Since there can only be one runtime loaded into a single process, my best bet seems to be to put my C# code into another process.</p>

[{'answer_id': 30670, 'author': 'Chris Farmer', 'author_id': 404, 'author_profile': 'https://Stackoverflow.com/users/404', 'pm_score': 0, 'selected': False, 'text': '<p>I cannot recommend this as <em>the way</em>, but you could create a COM-callable wrapper for your C# library, then create a VB6 ActiveX exe project that delegates calls to your C# library.</p>\n'}, {'answer_id': 30684, 'author': 'Lars Truijens', 'author_id': 1242, 'author_profile': 'https://Stackoverflow.com/users/1242', 'pm_score': 1, 'selected': False, 'text': '<p><a href="http://www.codeproject.com/KB/COM/BuildCOMServersInDotNet.aspx" rel="nofollow noreferrer">Here</a> we can read that it is possible, but the exe will be loaded as an library and not started in it\'s own process like an exe. I don\'t know if that is a problem for you? It also contains some possible solutions if you do want to make it act like a real out of process com server. But maybe using another way of inter process communication is better. Like .Net Remoting.</p>\n'}, {'answer_id': 31499, 'author': 'Joel Lucsy', 'author_id': 645, 'author_profile': 'https://Stackoverflow.com/users/645', 'pm_score': 0, 'selected': False, 'text': "<p>Why can't you load the .net runtime into you process space? It is possible to host the .net runtime and call into .net using COM.</p>\n"}, {'answer_id': 39106, 'author': 'Erick Sgarbi', 'author_id': 4171, 'author_profile': 'https://Stackoverflow.com/users/4171', 'pm_score': 4, 'selected': True, 'text': "<p>You can create COM+ components using System.EnterpriseServices.ServicedComponent. Consequently, you'll be able to create out-of-proc and in-proc (client) component activation as well as all COM+ benefits of pooling, remoting, run as a windows service etc.</p>\n"}]
['https://Stackoverflow.com/questions/30653', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/814/']