0

I am trying to execute MSdeploy.exe using c# dotnet and while I run the code I am getting an exception under main module saying A 32 bit processes cannot access modules of a 64 bit process.

below is the code :

string temp = @"C:\Projects\AUTODEPLOY\IIS\AppUAT";
     string   sourcePackageLocation = @"C:\Projects\AUTODEPLOY\SERVERS\UAT\WATCH\Test.zip";
        ProcessStartInfo startInfo = new ProcessStartInfo();
        // Use ProcessStartInfo class
        startInfo.CreateNoWindow = false;
        startInfo.UseShellExecute = false;
        startInfo.FileName = msDeployPath;
        startInfo.WindowStyle = ProcessWindowStyle.Hidden;
         startInfo.Arguments = "-verb:sync -source:contentPath=" + temp + " -dest:package:" + sourcePackageLocation + "";

        try
        {

            using (Process exeProcess = Process.Start(startInfo))
            {
                exeProcess.WaitForExit();
                exitCode = exeProcess.ExitCode;
            }

        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
            Console.WriteLine("Deploy Failed");
        }

The error occurs is :

{"A 32 bit processes cannot access modules of a 64 bit process."} System.Runtime.InteropServices.ExternalException {System.ComponentModel.Win32Exception}

Native code 299

Can anyone please help me out to understand the problem?

Ramkrishna Sharma
  • 6,961
  • 3
  • 42
  • 51
Sidharth
  • 65
  • 9
  • 1
    Your code is compiled as 32bit and it's calling a 64bit executable and that's not allowed. Recompiled to be all 32bit or all 64bit. – AlG Mar 29 '16 at 11:49
  • 2
    check [this](http://stackoverflow.com/questions/2003573/how-to-start-a-64-bit-process-from-a-32-bit-process) – Dudi Keleti Mar 29 '16 at 12:15

0 Answers0