【问题标题】:CAB Installation Unsucessfully using wceload使用 wceload 安装 CAB 失败
【发布时间】:2016-03-28 13:35:36
【问题描述】:

当我运行此应用程序时,我收到一条消息,指出 DeviceApplication.CAB 安装不成功。 我检查了 windows 目录,发现 wceload.exe 可用。

我已将 cab 放在当前 exe 正在运行的目录中。

知道怎么做吗??

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;
        }


    }
}

【问题讨论】:

    标签: c# windows-mobile compact-framework cab


    【解决方案1】:

    回答我自己的问题,

    这是因为我在这个过程中给出的路径,

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

    【讨论】:

    • 您的 InstallationSuccessCheck() 检查 CAB 的存在,但您使用 /nodelete 选项指定了 wceload.exe。这怎么行?
    猜你喜欢
    • 2013-07-22
    • 2011-07-09
    • 2010-12-11
    • 1970-01-01
    • 2019-03-14
    • 2013-04-15
    • 2018-05-09
    • 2018-12-25
    • 2020-12-25
    相关资源
    最近更新 更多