0

I've been trying to create a dll file that can be registered and used by other applications using Visual Studio 2019 but to no avail. This is what I've done so far:

Create a Class Library:

<ComClass(MyClass.ClassId, MyClass.InterfaceId, MyClass.EventsId)>
Public NotInheritable Class MyClass
    
    Public Const ClassId As String = "5C15AC97-E0DD-4D3B-A5F4-834360A1EB31"
    Public Const InterfaceId As String = "70C153A6-2576-4C6A-91FB-1AC07D7985CE"
    Public Const EventsId As String = "1030DA19-642D-42D0-877C-29BBBF5FC45C"

... rest of class definition with a constructor

In the properties: Application -> Assembly Information, I checked the option "Make assembly COM-visible" Compile, I checked the "Register for COM interop" option

I have 1 error and 1 warning: Error: Cannot register type library \MyClass.tlb. Error accessing the OLE registry (is it because I don't have admin rights on my machine?) Warning: \MyClass.dll does not contain any types that can be registered for COM Interop.

What I'd like to do is build my solution, retrieve the dll file, store it on another computer where I have admin rights and register it so that I can use my object in another application, just like I used to do back in the VB6 days. If I try to register the dll file that is generated, I get a "entry-point not found" message.

What am I missing to achieve what I want?

Thanks

Mu21
  • 17
  • 10
  • I don't see the `COMVisible` attribute applied to the class? – GSerg Oct 03 '20 at 12:37
  • 1
    You must run VS elevated to avoid the error. Use Project > Properties > Application tab, Assembly Information button, tick "Make assembly COM -Visible". On the target machine you must use Regasm.exe instead of Regsvr32.exe – Hans Passant Oct 03 '20 at 12:44
  • `rest of class definition with a constructor` - does that constructor require a parameter? Is there a parameterless constructor on the class? – GSerg Oct 03 '20 at 13:22
  • [Turn a simple DLL into a COM interop component](https://stackoverflow.com/q/7092553/7444103). See the first answer there. There's another answer that includes some notes about event sinks. As already mentioned, you're missing a couple of pieces and it's not clear what interfaces you're exposing there and how. – Jimi Oct 03 '20 at 18:41
  • I made it work by using regasm with the /codebase switch. I was able to register it and then use it in another application – Mu21 Oct 07 '20 at 15:01
  • How are things going? Please let us know if there is any progress. – dear_vv Oct 21 '20 at 09:10

0 Answers0