We have this config:
The DLL should be called from the mainApp application to do this:
I read this and this and they suggest to copy the .config file
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 interop
check box in Project Properties>BuildMake assembly COM-Visible
in 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 Program
and 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