I am trying to execute a simple SSIS package from vb6 application. I can execute the same package from c#.
This is my code in vb6:
pkgLocation = "c:\Package.dtsx"
Set dtsApp = New Application
Set package = dtsApp.LoadPackage(pkgLocation, True, Nothing)
Set pkgContainer = package
pkgResults = package.Execute
If (pkgResults = 0) Then
MsgBox "Success"
Else
MsgBox "Fail"
End If
In my log file, I see this error: The Execute method on the task returned error code 0x80131621 (Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.). The Execute method must succeed, and indicate the result using an "out" parameter.
I my c# program I have to add an App.config file to resolve the same error:
<?xml version="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>
But How can I do the same from vb6 application?
Edit 1:
In my vb6 project I am using this references:
C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\DTS.DLL - Microsoft DTS Runtime 1.0 C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\MsDtsSrvrUtil.dll - Dts Server 9.0 Type Library
The SSIS package was made with : Sql Server Data Tools for Visual Studio 2013
Thanks for your help.
I found the solution in this post Using app.config with Interop Controls
In short : If my VB6 exe es called VB6.exe , I need to put in the same directory as the file VB6.exe the App.config file but renamed VB6.exe.config
Your version of calling the object is older/newer than the version you are trying to open it seems.
You need to reference the correct version object in your app under project/references.
User contributions licensed under CC BY-SA 3.0