运行时错误 -2146234341 (8013101b) 从 VB.NET 到 VB6 的自动化错误,使用清单? [英] Run-time error -2146234341 (8013101b) Automation error from VB.NET to VB6, using manifest?

查看:17
本文介绍了运行时错误 -2146234341 (8013101b) 从 VB.NET 到 VB6 的自动化错误,使用清单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在无 reg 的情况下从 VB6 客户端访问 VB.NET DLL (.NET FX 4.0).

I am trying to access a VB.NET DLL (.NET FX 4.0) from a VB6 client in a reg-free scenario.

我尝试按照 http://msdn.microsoft.com 中的示例进行操作/en-us/library/ms973915.aspx,但没有成功.我下载(文章中的链接)源并编译,没有成功(错误消息:运行时错误'-2146234341(8013101b)':自动化错误).使用注册的VB.NET DLL从VB6 IDE运行.

I tried to follow the example from http://msdn.microsoft.com/en-us/library/ms973915.aspx, but with no success. I downloaded (link in the article) the sources and compiled, no success (error message: Run-time error '-2146234341 (8013101b)': Automation error"). Running from VB6 IDE using registered VB.NET DLL works.

我尝试了其他示例,将 .NET DLL 创建为 COM 类(使用 VS2010 中的COM 类"模板),是否嵌入了引用 DLL 的清单,但对我没有任何作用.

I tried other examples where the .NET DLL is created as a COM Class (using "COM Class" template from VS2010), with manifest for referenced DLL embedded or not, but nothing worked for me.

有人可以提供一些简单的源代码,其中包含 VB6 客户端在 reg-free 场景中使用的 VB.NET DLL (.NET FX v4) 的清单示例?

Can somebody provide some simple source code with manifests example of VB.NET DLL (.NET FX v4) used in VB6 client in reg-free scenario?

非常感谢.

推荐答案

运行时错误-2146234341 (8013101b)":自动化错误

Run-time error '-2146234341 (8013101b)': Automation error

您的问题与清单无关,您需要先解决这个问题.错误代码是 COR_E_NEWER_RUNTIME.换句话说,您的 [ComVisible] 类无法加载,因为它依赖于 CLR 版本 4.而且程序很可能已经加载了 CLR 版本 2,因为首先询问了另一个 [ComVisible] 类.它要求第 2 版.

Your problem doesn't have anything to do with a manifest, you'll need to fix this one first. The error code is COR_E_NEWER_RUNTIME. In other words, your [ComVisible] class cannot be loaded because it depends on CLR version 4. And the program has already loaded the CLR, version 2 most likely, because another [ComVisible] class asked first. And it asked for version 2.

您需要一个 app.exe.config 文件来强制加载 CLR 版本 4,即使有人要求加载版本 2.它应该如下所示:

You'll need an app.exe.config file that forces CLR version 4 to get loaded, even when somebody asks for version 2. It should look like this:

<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"/>
  </startup>
</configuration>

将其命名为与 vb6 exe 相同的名称(如foo.exe.config"以匹配foo.exe")并将其放在与 .exe 相同的目录中.如果您想使用 VB6 IDE 来调试使用此库的 vb6 代码,那么您还需要 c:program filesmicrosoft visual studiovb98 中的 vb6.exe.config

Give it the same name as the vb6 exe (like "foo.exe.config" to match "foo.exe") and put it in the same directory as the .exe. If you want to use the VB6 IDE to debug your vb6 code that uses this library then you also need vb6.exe.config in c:program filesmicrosoft visual studiovb98

这篇关于运行时错误 -2146234341 (8013101b) 从 VB.NET 到 VB6 的自动化错误,使用清单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆