Signed assembly not recognised by VB6

  • Thread starter Thread starter pranesh.nayak
  • Start date Start date
P

pranesh.nayak

Hello group,

I'm facing a problem in calling a signed .Net class library (c#) from
VB6 exe.

I have a VB6 exe calling .net assembly. The call to .Net dll works fine
when i deploy the .Net assembly as Private assembly. But here the only
issue is i need to place .Net dll and VB6 exe in same location.

To avoid this location dependency issue i tried registering the .Net
dll in GAC (signed with key pair). Now, when i call the .Net assembly
from VB6 it doesn't seem to be recognised by VB6. The code in VB6
doesn't throw any error, but the function in assembly is not getting
called.

Please suggest.

-Cheers
 
Pranesh,

I would go with a greenfield approach. Basically, remove the assembly
from the GAC, and unregister the assembly (regasm). Also, remove the
reference from your VB project and shut VB6 down.

Then, put the assembly in the GAC, register it with REGASM, and then
open up VB and find the reference to make to your project.

Are you setting the GUID in your code for your interfaces and for your
classes that are being used in VB (you should be exposing interfaces that
are visible to COM and not the class itself).

Hope this helps.
 
Thanks for your reply Nicholas !!!

I have already tried the greenfield approach without any success.

Below is my interface defn. Is setting GUID compulsary?. If yes thn how
can i genarate those GUID's?

[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface myInterface
{
Boolean myMethod(String ..., Int32 ...);
}

[ComSourceInterfaces("myCOM.MyInterface")]
[ClassInterface(ClassInterfaceType.None)]
[ProgId("myCOM.myClass")]
public class myClass : myInterface{}

- cheers

Pranesh,

I would go with a greenfield approach. Basically, remove the assembly
from the GAC, and unregister the assembly (regasm). Also, remove the
reference from your VB project and shut VB6 down.

Then, put the assembly in the GAC, register it with REGASM, and then
open up VB and find the reference to make to your project.

Are you setting the GUID in your code for your interfaces and for your
classes that are being used in VB (you should be exposing interfaces that
are visible to COM and not the class itself).

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Hello group,

I'm facing a problem in calling a signed .Net class library (c#) from
VB6 exe.

I have a VB6 exe calling .net assembly. The call to .Net dll works fine
when i deploy the .Net assembly as Private assembly. But here the only
issue is i need to place .Net dll and VB6 exe in same location.

To avoid this location dependency issue i tried registering the .Net
dll in GAC (signed with key pair). Now, when i call the .Net assembly
from VB6 it doesn't seem to be recognised by VB6. The code in VB6
doesn't throw any error, but the function in assembly is not getting
called.

Please suggest.

-Cheers
 
FYI:
i foundout how to create GUID, Please let me know whether it is
compulsary to set GUID to make my code work?.

Thanks for your reply Nicholas !!!

I have already tried the greenfield approach without any success.

Below is my interface defn. Is setting GUID compulsary?. If yes thn how
can i genarate those GUID's?

[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface myInterface
{
Boolean myMethod(String ..., Int32 ...);
}

[ComSourceInterfaces("myCOM.MyInterface")]
[ClassInterface(ClassInterfaceType.None)]
[ProgId("myCOM.myClass")]
public class myClass : myInterface{}

- cheers

Pranesh,

I would go with a greenfield approach. Basically, remove the assembly
from the GAC, and unregister the assembly (regasm). Also, remove the
reference from your VB project and shut VB6 down.

Then, put the assembly in the GAC, register it with REGASM, and then
open up VB and find the reference to make to your project.

Are you setting the GUID in your code for your interfaces and for your
classes that are being used in VB (you should be exposing interfaces that
are visible to COM and not the class itself).

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Hello group,

I'm facing a problem in calling a signed .Net class library (c#) from
VB6 exe.

I have a VB6 exe calling .net assembly. The call to .Net dll works fine
when i deploy the .Net assembly as Private assembly. But here the only
issue is i need to place .Net dll and VB6 exe in same location.

To avoid this location dependency issue i tried registering the .Net
dll in GAC (signed with key pair). Now, when i call the .Net assembly
from VB6 it doesn't seem to be recognised by VB6. The code in VB6
doesn't throw any error, but the function in assembly is not getting
called.

Please suggest.

-Cheers
 
Back
Top