Given a specific class:
public class Klass
{
    public int value;
    public void doSomething(){
        return;
    }
}
To make said class COM visible, as far as I know, one needs to do a few things:
- Import System.Runtime.InteropServices
- Create an interface for the class.
- Extend the interface created.
- Create 2 unique GUIDs, one for the Interface and another for the class.
- Add Dispatch IDs to the interface.
Producing something like:
[Guid("EAA4976A-45C3-4BC5-BC0B-E474F4C3C83F")]
public interface IKlass
{
    [DispId(0)]
    public int value;
    [DispId(1)]
    public void doSomething();
}
[Guid("0D53A3E8-E51A-49C7-944E-E72A2064F938"),
    ClassInterface(ClassInterfaceType.None)]
public class Klass : IKlass
{
    public int value;
    public void doSomething(){
        return;
    }
}
The resulting code looks utterly gross in my opinion... The question is, is there a simple cleaner method of creating these COM interfaces? I can imagine modifying the build process myself to give a interop feature. E.G.
public interop class Klass
{
    public interop int value;
    //...
}
However, this is non-standard, which has it's issues as well. Is there anything built-in to Visual Studio / C# that I can use to make building COM interfaces easier/cleaner?
 
    