使用WiX卸载应用程序之前批处理文件未执行 [英] Batch file is not executing before application uninstalled using WiX

查看:54
本文介绍了使用WiX卸载应用程序之前批处理文件未执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要卸载Excel插件时试图运行的批处理文件未执行.我正在使用以下自定义操作来进行安装后以及卸载产品时的操作.以下代码:

My batch file that I'm trying to run when an Excel plugin needs to be uninstalled is not executing. I'm using the following custom actions to do post install and also on uninstalling the product. The following code:

  <CustomAction Id="registeraddin" ExeCommand="[INSTALLFOLDER]RegisterMilerAddIn.bat" Directory="INSTALLFOLDER" Impersonate="no" Execute="deferred" Return="asyncWait" />
  <CustomAction Id="unregisteraddinpostinstall" ExeCommand="[INSTALLFOLDER]UnRegisterMilerAddIn.bat" Directory="INSTALLFOLDER" Impersonate="no" Execute="deferred" Return="asyncWait" />

  <InstallExecuteSequence>
    <Custom Action="registeraddin" After="InstallFiles">NOT Installed</Custom>
    <Custom Action="unregisteraddinpostinstall" After="InstallFiles">Installed AND (REMOVE = "ALL")</Custom>
  </InstallExecuteSequence>

在日志中产生此错误:

MSI(s)(44:04)[11:29:00:437]:执行操作:ActionStart(Name = unregisteraddinpostinstall ,,)

MSI (s) (44:04) [11:29:00:437]: Executing op: ActionStart(Name=unregisteraddinpostinstall,,)

MSI(s)(44:04)[11:29:00:437]:执行操作:CustomActionSchedule(Action =取消注册后安装,ActionType = 1058,Source = C:\ Program文件(x86)\ Werner Enterprises \ Web Miles ExcelAddin \,Target = C:\ Program Files(x86)\ Werner Enterprises \ Web MilesExcel Addin \ UnRegisterMilerAddIn.bat,)

MSI (s) (44:04) [11:29:00:437]: Executing op: CustomActionSchedule(Action=unregisteraddinpostinstall,ActionType=1058,Source=C:\Program Files (x86)\Werner Enterprises\Web Miles Excel Addin\,Target=C:\Program Files (x86)\Werner Enterprises\Web Miles Excel Addin\UnRegisterMilerAddIn.bat,)

MSI(s)(44:04)[11:29:00:846]:注意:1:1722 2:unregisteraddinpostinstall 3:C:\ Program Files(x86)\ Werner企业\ Web Miles Excel加载项\ 4:C:\ Program Files(x86)\ WernerEnterprises \ Web Miles Excel Addin \ UnRegisterMilerAddIn.bat

MSI (s) (44:04) [11:29:00:846]: Note: 1: 1722 2: unregisteraddinpostinstall 3: C:\Program Files (x86)\Werner Enterprises\Web Miles Excel Addin\ 4: C:\Program Files (x86)\Werner Enterprises\Web Miles Excel Addin\UnRegisterMilerAddIn.bat

MSI(s)(44:04)[11:29:00:846]:注意:1:2205 2:3:错误MSI(s)(44:04)[11:29:00:846]:注意:1:2228 2:3:错误4:选择 Message FROM Error 在哪里 Error = 1722 CustomActionunregisteraddinpostinstall返回实际错误代码100(请注意,如果在沙箱中进行翻译,则可能不会100%准确)

MSI (s) (44:04) [11:29:00:846]: Note: 1: 2205 2: 3: Error MSI (s) (44:04) [11:29:00:846]: Note: 1: 2228 2: 3: Error 4: SELECT Message FROM Error WHERE Error = 1722 CustomAction unregisteraddinpostinstall returned actual error code 100 (note this may not be 100% accurate if translation happened inside sandbox)

MSI(s)(44:04)[11:29:10:900]:注意:1:2205 2:3:错误MSI(s)(44:04)[11:29:10:900]:注意:1:2228 2:3:错误4:选择 Message FROM Error 在哪里 Error = 1709

MSI (s) (44:04) [11:29:10:900]: Note: 1: 2205 2: 3: Error MSI (s) (44:04) [11:29:10:900]: Note: 1: 2228 2: 3: Error 4: SELECT Message FROM Error WHERE Error = 1709

MSI(s)(44:04)[11:29:10:900]:产品:WebMiles_Addin_Installer-错误1722.此Windows Installer程序包有问题.一种作为安装程序一部分运行的程序未按预期完成.接触您的支持人员或包装供应商.行动unregisteraddinpostinstall,位置:C:\ Program Files(x86)\ WernerEnterprises \ Web Miles Excel Addin \,命令:C:\ Program Files(x86)\ Werner Enterprises \ Web Miles ExcelAddin \ UnRegisterMilerAddIn.bat

MSI (s) (44:04) [11:29:10:900]: Product: WebMiles_Addin_Installer -- Error 1722. There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected. Contact your support personnel or package vendor. Action unregisteraddinpostinstall, location: C:\Program Files (x86)\Werner Enterprises\Web Miles Excel Addin\, command: C:\Program Files (x86)\Werner Enterprises\Web Miles Excel Addin\UnRegisterMilerAddIn.bat

那个错误对我来说是晦涩的.我也没有在我的批处理文件中做真正的花哨的东西.Excel加载项的 安装 有效 (这是此应用程序的前提).但显然,我无法以相同的方式卸载该插件,因此日志中的上述错误也会消失.

That error is obscure to me. I'm not doing real fancy stuff in my batch file either. The installation of the Excel addin works fine (which is the premise of this application). But I can't uninstall the addin, apparently, in the same manner, so goes the aforementioned error in the log.

为完整起见,这是我的注册批处理的内容(RegisterMilerAddIn.bat):

For completeness, this is the contents of of my register batch (RegisterMilerAddIn.bat):

SET WorkFolder= "C:\Program Files (x86)\Werner Enterprises\Web Miles Excel Addin"

SET _NET_4_Folder= %WinDir%"\Microsoft.NET\Framework\v4.0.30319"

%_NET_4_Folder%\regasm.exe %WorkFolder%\Miler.ExcelAddin.dll /Codebase /tlb:%WorkFolder%\Miler.ExcelAddin.tlb >> C:\temp\log.txt

并取消注册批处理(UnRegisterMilerAddIn.bat):

SET WorkFolder= "C:\Program Files (x86)\Werner Enterprises\Web Miles Excel Addin"

SET _NET_4_Folder= %WinDir%"\Microsoft.NET\Framework\v4.0.30319"

%_NET_4_Folder%\regasm.exe /unregister %WorkFolder%\Miler.ExcelAddin.dll /Codebase /tlb:%WorkFolder%\Miler.ExcelAddin.tlb >> C:\temp\log.txt

推荐答案

在研究并尝试了许多不同的属性之后,我找到了解决问题的方法.因此,我将其发布在这里可能对其他人有所帮助.我发现我的批处理文件已被删除,然后才能运行外接程序卸载过程,就像Brian Sutherland逃避的那样.我最终发现在删除所有文件之前的卸载中一次执行了以下代码.

After researching and trying many different atrributes, I found a solution to my problem. So I'm posting it here may it help someone else. I was finding that my batch file was being deleted before I could run the addin uninstall process, as Brian Sutherland eluded to. I finally found the following code executed at a time in the uninstall that was before the removal of all the files.

<InstallExecuteSequence>
    <Custom Action="unregisteraddinpostinstall" After="InstallInitialize">REMOVE="ALL"</Custom>
  </InstallExecuteSequence>

因此,我仍将使用上面的代码,但是我将实现Stein Asmul的建议来清理进程,而不使用批处理文件.我仍然使用 After ="InstallInitialize" 的原因是我的ExcelAddin.dll也是 regasm.exe/unregister 流程的一部分,用于删除类型类库.在运行脚本之前,它也已被删除.在实现After ="InstallInitialize"> REMOVE ="ALL"之后,脚本将按预期运行.再次感谢Brian和Stein!

So I will still be using the above code, but I am going to implement Stein Asmul's suggestions to clean up my process and not use a batch file. The reason I am still using After="InstallInitialize" is my ExcelAddin.dll is also part of the regasm.exe /unregister process to remove Type Class Libraries. It too was being deleted before I could run the script. After I implemented After="InstallInitialize">REMOVE="ALL", the script is working as expected. Thanks again to Brian and Stein!

这篇关于使用WiX卸载应用程序之前批处理文件未执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆