0

我有这个 wxs 的配置

<CustomAction Id="UninstallDriver" BinaryKey="Setup.CustomActions.dll"
              DllEntry="UninstallDriver" Execute="immediate" Return="check"/>
<Custom Action="UninstallDriver" After="InstallInitialize">Installed AND (NOT REINSTALL)</Custom>

和自定义操作:

  /// <summary>
    /// Uninstall driver
    /// </summary>
    /// <param name="session"></param>
    /// <returns></returns>
    [CustomAction]
    public static ActionResult UninstallDriver(Session session)
    {
        try
        {
            session.Log("Start unistalling redirect driver");
            var toolPath = GetPathToFile(session, @"%INSTALLLOCATION%Tools.exe");
            session.Log("Path for tools={0}", toolPath);
            if (!File.Exists(toolPath))
            {
                session.Log("Can't find Tools.exe at specified location");
                return ActionResult.Failure;
            }
            var proc = Process.Start(toolPath);
            proc.StartInfo.Arguments = @"/uninstall";
            proc.Start();
            var exited = proc.WaitForExit(10000);
            if (exited && proc.ExitCode == 0)
            {
                session.Log("Driver uninstall completed");
                return ActionResult.Success;
            }
        }
        catch (Exception ex)
        {
            session.Log("Error while uninstalling driver={0}", ex.Message);
        }
        return ActionResult.Failure;
    }

当它在卸载时调用此自定义操作时,我有“无法运行此安装完成所需的 DLL”。但是当我为 x86 构建 Tools.exe 时,没有出现任何问题。如何使其适用于 64x 位版本?

4

0 回答 0