Getting System.BadImageFormatException Error while Running the .Net Program in x64 Server

1

I have an old DotNet Program compiled in 32 Bit, which has a Form to load and execute SSIS package. For Executing SSI Package it uses the Assembly Microsoft.SqlServer.DTSRuntimeWrap which is present in 32 Bit as displayed below.

using Microsoft.SqlServer.Dts.Runtime.Wrapper;
.
.
namespace WinFmAppETLControl
{
  public class FrmControl : Form
  {

        this.ProcessStep1();

        private void ProcessStep1()
         {
         if (((IDTSApplication100)new ApplicationClass()).LoadPackage("C:\\Users\\abc\\MyData\\WinFmAppETLControl\\ETL\\SUN Daily ETL\\Batch and SysidRange.dtsx", true, (IDTSEvents100)null).Execute() == DTSExecResult.DTSER_SUCCESS){

        MessageBox.Show("Success");
        }
        else{
        MessageBox.Show("Failure");
        }
    }
  }
}

Now i need to Migrate this program to 64 Bit new Server. I Create the exe file to run in the server. When i build the project in x64 and run on server, i am getting below error while executing the exe file.

Could not load file or assembly 'Microsoft.SqlServer.DTSRuntimeWrap, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. An attempt was made to load a program with an incorrect format.

When i build the project in x86 and run on server, i am getting below error while executing the exe file.

System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {BA785E28-3D7B-47AE-A4F9-4784F61B598A} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

The SSIS running on server is x64 bit (D:\Program Files\Microsoft SQL Server\110\DTS\Binn\MsDtsSrvr.exe").

Please help if anyone knows. I checked many answers but couldn't find the solution. I am relatively new to .Net

c#
.net
sql-server
ssis
etl
asked on Stack Overflow Jun 13, 2019 by Ashutosh • edited Jun 13, 2019 by Hadi

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0