We have this config:
- mainApp [ VB6 ]
- DLL [ C#, .Net Framework 4.8, Entity Framework]
- TestApp [ C#, .Net Framework 4.8]
The DLL should be called from the mainApp application to do this:
- read some info from the database [EF]
- send the info to the api and get response code
- update the code to the database [EF]
I read this and this and they suggest to copy the .config file
- as VB6.exe.config (in my vb6 folder- to use for debugging)
- as mainApp.exe.config (to be used from the .exe)
PROBLEM1: I am not able to test it because I cannot reference my dll from the VB6 IDE.
I tried to add reference to my dll from VB6 but it failed. Tried to regsrv32.exe my dll and i got the error below:
The module "mydll.dll" was loaded but the entry-point DllRegisterServer was not found. Make sure that "mydll.dll" is a valid DLL OR OCX file and then try again later.'
PROBLEM2: Now that I have created correctly the DLL and have register it I am trying to Debug both the maniApp and the DLL, I have break points in the DLL but are never hit.
What should I do?
With the help of @GSerg pointing me to the right direction I managed to find a solution that worked for my case. My goal was to be able to use the DLL and debug both projects at the same time.
These are the steps followed
Register for COM interopcheck box in Project Properties>BuildMake assembly COM-Visiblein project properties>Application>Assembly Information...sn -k "path-to-key\myKey123.snk")regasm "full-path-to-my-dll\\mydll.dll" /tlb:"full-path-to-my-tlb\\mydll.tlb")gacutil /i "path-to-mydll-debug-folder\mydll.dll")Start External Programand browse to the location of VB6.exe.Every time changes are done in the C# class library project dig steps 6 & 7 again
UPDATE: All referenced projects must be changed to x86 ( Project Properties > Build > Platform Target) and signed with a strong name (Project Properties > Signing> Sign the assembly checkbox and select or create a strong name key file)
Resources:
TheGeneral's Answer to Similar Problem
Exposing .NET Components to COM
Create a DLL by CSharp or VB.Net for VBA
How to: Sign an assembly with a strong name
Signing assemblies - basics
GAC-Global Assembly Cache