I trying to get a .NET DLL to be exposed as a COM class, too, and be accessible from non-.NET languages like VBA, C++ or Delphi.
I created my C# DLL just fine, and I was able to register it on my test server as a COM component:
C:\Windows\Microsoft.NET\Framework\v4.0.30319>regasm c:\inst\MyComComponent.dll /codebase
Microsoft (R) .NET Framework Assembly Registration Utility 4.0.30319.1
Copyright (C) Microsoft Corporation 1998-2004. All rights reserved.RegAsm : warning RA0000 : Registering an unsigned assembly with /codebase can cause your assembly to interfere with other applications that may be installed on the same computer. The /codebase switch is intended to be used only with signed assemblies. Please give your assembly a strong name and re-register it.
Types registered successfully
OK, it worked - but it throws that ugly warning, so I went and created a *.snk file for my class library
sn -k MyComComponent.snk
and I added this *.snk file to my project properties (under "Signing"). It compiles fine, but when I transfer it to my test server and try to re-register it again, I get this:
C:\Windows\Microsoft.NET\Framework\v4.0.30319>regasm c:\inst\MyComComponent.dll /codebase
Microsoft (R) .NET Framework Assembly Registration Utility 4.0.30319.1
Copyright (C) Microsoft Corporation 1998-2004. All rights reserved.RegAsm : error RA0000 : Failed to load 'c:\inst\MyComComponent.dll' because it is not a valid .NET assembly
I beg your pardon!?!?!? What happened here - and how to fix it??