0

When i run this application i get an message that DeviceApplication.CAB installation was unsuccessfull . I checked inside the windows directory and i found that wceload.exe is available.

I have placed the cab inside the directory where the present exe is running .

Any idea how to do this ??

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;

namespace DeviceApplication3
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

        }


        public void displayMesage() {    
            LaunchInstaller("DeviceApplication.cab");
        }

        private static bool LaunchInstaller(string cabFile)
        {
            // Info on WceLoad.exe
            //http://msdn.microsoft.com/en-us/library/bb158700.aspx
            const string installerExe = "\\windows\\wceload.exe";

            const string processOptions = "";
            try
            {
                ProcessStartInfo processInfo = new ProcessStartInfo();
                processInfo.FileName = installerExe;
                processInfo.Arguments = processOptions + " \"" + cabFile + "\"";

                Process process = Process.Start(processInfo);
                if (process != null)
                {
                    process.WaitForExit();
                }                                

                return InstallationSuccessCheck(cabFile);
            }
            catch (Exception e)
            {
                MessageBox.Show("Sorry, for some reason this installation failed.\n" + e.Message);
                Console.WriteLine(e);
                throw;
            }
        }

        private static bool InstallationSuccessCheck(string cabFile)
        {
            if (File.Exists(cabFile))
            {
                MessageBox.Show("Something in the install went wrong.  Please contact support.");

                return false;
            }
            return true;
        }


    }
}
user3383301
  • 1,891
  • 3
  • 21
  • 49

1 Answers1

0

Answering my own question ,

Its because of the path i gave in the process ,

  ProcessStartInfo psi = new ProcessStartInfo(@"Windows\wceload.exe", "/nodelete \"Program Files\\DeviceApplication3\\DeviceApplication.CAB\"");

        Process proc = Process.Start(psi);
user3383301
  • 1,891
  • 3
  • 21
  • 49
  • And your InstallationSuccessCheck() checks the existence of the CAB but you specified wceload.exe with the /nodelete option. How can this work? – josef Dec 23 '15 at 07:04