1
votes

we have an ActiveX DLL built in C#; the DLL is used in a VB6 application (and it will be also consumed by a classic ASP application).

The DLL is a C# Class Library Project with

  • class and interface Guids attributes in source code
  • COM related attributes/settings in project
  • progid attribute in source code

all apparently properly set.

Proof is, we have registered the DLL with regasm /codebase /tlb:xxxxx and VB6 dev env can see the COM object in references window.

After adding the COM DLL reference to the project, Intellisense works and sees everything fine, the application compiles correctly.

The problem is that, if we don't place a copy of the DLL in the same folder as the compiled application exe file, it fails while trying to instantiate an instance of a class in the DLL; the error returned is "System cannot find the file specified". If a copy of the DLL is in the same place as the application exe, everything works ok.

I've found references to similar problems around, but no hint or clues on how to solve.

Mario

2
Are you sure you haven't registered the assembly in a virtualized registry location? I would expect that if you dump it into the app folder, the VB6 runtime is registering it in place. So you then have two copies of the file, each registered for a different user and/or user token.Bob77
Thanks, but this is happening on Windows XP, I'm not sure there are registry virtualizations involved in it... as a weird enough update, everything works well from IIS/Classic ASP too, even though the DLL file is not in the same folder as w3wp.exe...mabian69
That's not a VB6 error message. What does the C# DLL depend on? It will need all its dependant DLLs in its own bin folder. If they aren't, it will give a similar error.Deanna
The DLL doesn't have any external references other than some standard .net framework (4.0) assemblies.mabian69
Not a typical problem if the assembly doesn't have any dependencies. Use Fuslogvw.exe to troubleshoot assembly resolution problems.Hans Passant

2 Answers

2
votes

First, VB6 only uses the TypeLib for intellisense, so that doesn't prove anything in regards to the DLL.

I suggest that you use ProcessMonitor, found here to monitor the process of loading the VB6 dll. Make sure it is not in the app folder, keep it where you registered it. You will be able to see both the registry lookups to locat the path, and the file IO as it searches the path.

Post back with the results if that doesn't solve it.

0
votes

In VB6 if you are using RegAsm and not placing the assembly in the GAC it has to be in the same directory as the executing application unless you use the /Codebase option when RegAsm'ing the file.