I\'m developing a DCOM server in .NET 4 (VS2010, C#). By itself, this is working fine.
Now, I also need to develop a .NET client for this DCOM server, but I am unabl
I managed to get DCOM working, but I'm not certain if it can be done from a TypeLib. Modifying the IDL allowed me to import the type library, but it eventually failed during compilation (although this is treated as a warning by Visual Studio). It might still be possible to make even more modifications to the file, but I'm using a much easier solution.
All the interface definitions for the DCOM server were moved to a separate assembly, which is then referenced directly from the .NET client. This circumvents the importing problem.
Then, accessing the DCOM server is no different from what one might expect:
Guid clsId = new Guid("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX");
Type type = Type.GetTypeFromCLSID(clsId);
IMyInterface comObject = (IMyInterface)Activator.CreateInstance(type);
Moving the interfaces to a separate assembly is not strictly necessary, but this minimizes the size of the shared assembly.