For every example of registering .NET COM objects in the web, I see the tool "regasm" for doing the job. Everybody does so!!!
But it never worked for me! I am tired of trying to overcome it! My only solution would be regsvr32, which requires a function which I could only define in C++.
Please tell me why wouldn't it just work!!!
Considering that it doesn't work on all 4 of my computers, plus 3 virtual machines, running Windows 7 down to 2000, can anyone show me a working example of a regasm call? I think I am an idiot.
Registering [ComVisible] .NET assemblies with Regsvr32.exe is not possible. It doesn't have the required DllRegisterServer entrypoint that Regsvr32 needs. You will have to make it work with Regasm.exe or a Setup project. The latter is necessary when you deploy your server to another machine.
There are few failure modes. Other than:
forgetting to use the /codebase option. Required if you don't deploy the assembly to the GAC, something you should not do on your dev machine.
using the wrong version of Regasm.exe. There are two on a 64-bit machine, the Framework64 directory contains the one you have to use if the client code is 64-bit.
running it from a command prompt that is not elevated. Regasm.exe writes to the HKLM hive of the registry, something that UAC actively prevents. That's an issue on Vista and Win7.
Just getting the assembly grossly wrong is of course possible too. Like not making one or more interfaces and/or classes [ComVisible].