COM components in .NET
-
Hi! I am doing some research about COM. I'm about to implements an application with several external dynamic interfaces that should be able to connect to, to be able to get data and/or set data. The thoughts is to use the OPC standards and as i understand it, most of it is COM related. My questions are: Is it possible to write a COM server in c# AND a COM Client in c# that communicates. I have read about this, but i have found alot of c#->c++ och vice verce. Not a pure .NET -> .NET the reason of why i want this is to create a program with interfaces that could be implemented by managed as well as unmanaged code. I have tried to use the codes from Nick Parker's and Heath Stewart's articles here at codeproject but i could not get it to work. If i use project->add reference, I get that i can not re-import a type library to a CLR assembly, since it was exported from a CLR assembly. if i use the the .NET coclass, as should be similar to QueryInteface().
[ComImport, Guid("B58D7C8C-2E2D-4AA6-8EAF-CF7CB448E353")] class CoClass { }
... I only get: An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in WindowsApplication3.exe Additional information: COM object with CLSID {B58D7C8C-2E2D-4AA6-8EAF-CF7CB448E353} is either not valid or not registered. Even though this COM object is visible in the OLE/COM obejct viewer and it is searchable in the register. I have tried gacutil.exe regasm.exe regscvr32.exe but nothing changes anything. I have tried to implement a .NET COM server with c++ sucessfully and i have managed to access the system library quartz.dll with .NET implementation. so i'm starting to think that it is not ment to be possible to .NET -> .NET interop. or is it ? appiciate any help thanks Andreas Johansson Software developer ABB Robotics Sweden