Run-time error -2146234341 (8013101b) Automation error from VB.NET to VB6, using manifest?

后端 未结 1 1024
孤独总比滥情好
孤独总比滥情好 2020-12-16 00:42

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

I tried to follow the example from http://msdn.microsoft.com/en-us/library

相关标签:
1条回答
  • 2020-12-16 01:26

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

    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.

    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>
    

    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 files\microsoft visual studio\vb98

    0 讨论(0)
提交回复
热议问题