.NET COM Interop on Windows 7 64Bit gives me a headache
- by Kevin Stumpf
Hey guys,
.NET COM interop so far always has been working quite nicely. Since I upgraded to Windows 7 I don't get my .NET COM objects to work anymore.
My COM object is as easy as:
namespace Crap
{
    [ComVisible(true)]
    [Guid("2134685b-6e22-49ef-a046-74e187ed0d21")]
    [ClassInterface(ClassInterfaceType.None)]
    public class MyClass : IMyClass
    {
        public MyClass()
        {}
        public void Test()
        {
            MessageBox.Show("Finally got in here.");
        }
    }
}
namespace Crap
{
    [Guid("1234685b-6e22-49ef-a046-74e187ed0d21")]
    public interface IMyClass
    {
    }
}
assembly is marked ComVisible as well.
I register the assembly using
regasm /codebase /tlb "path"
registers successfully (admin mode).
I tried regasm 32 and 64bit. Both time I get the error
"ActiveX component cant create object Crap.MyClass" using this vbscript:
dim objReg
Set objReg = CreateObject("Crap.MyClass")
MsgBox typename(objReg)
fuslogvw doesn't give me any hints either.
That COM object works perfectly on my Vista 32 Bit machine.
I don't understand why I haven't been able to google a solution for that problem.. am I really the only person that ever got into that problem?
Looking at OleView I see my object is registered successfully. I am able to create other COM objects as well.. it only does not work with my own ones.
Thank you,
Kevin