开发者

.NET interop COM DLL behaves differently in VB6 debugger

I have a .NET v2.0 Dll that exposes a few classes to COM. The assembly is called BLogic.DLL

I'm calling these classes from a legacy visual basic 6.0 application. I can generate and EXE file and if I have Blogic.dll in the same folder as the EXE, the program runs without a hitch.

However If I try and launch the same program within the VB6 debugger I get a:

   Automation Error    
   The syste开发者_运维百科m cannot find the file specified

I assume when I'm running in the debugger, the PLogic.dll file can't be found. I tried putting it in the System32 folder, and the same folder as the VB6.EXE file, but I still get the same error.

Other facts that may help:

PLogic.dll is NOT a strongly-named assembly. It depends on a 3rd party reference that isn't strongly signed so VS doesn't let me strongly sign it. However the 3rd party functionality isn't being called by the VB6 code, and it is not ComVisible.


If you don't put your ComVisible .NET assembly in the GAC then you have to use the /codebase option with Regasm.exe


It's been a while so I might be getting this confused but I have some memory that while debugging VB6 supporting dlls should be in the project folder, so in the same folder as the project file.

Edit: Just realised, since it's a COM DLL, the location shouldn't matter since it should have been registered, I can't remember how that works with .NET COM Dlls but I'd suggest trying out Regasm (since it's not got a strong name possibly you'd have to create the Tlib instead and the run Regtlib on that).


Just a thought: the error may be a "normal" exception within the DLL instead of an interop problem. The reason that this exception only occurs when debugging in VB6.exe may be that relative paths (./something.txt) are relative to the VB6.exe when debugging.


I had a similar issue that was solved by creating a VB6.exe.config file with the following content and placed it in the same folder as VB6.exe (C:\Program Files\Microsoft Visual Studio\VB98 on my computer):

<?xml version="1.0" ?>
<configuration>
    <startup>
        <supportedRuntime version="v2.0.50727" />
    </startup>
</configuration>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜