使用MSI包装器卸载ClickOnce - 错误

时间:2012-04-17 05:47:41

标签: wpf clickonce windows-installer

我有clickonce应用程序,其中一个要求是即使在应用程序运行时也要卸载应用程序。所以我创建了一个MSI包装器,它安装了clickonce应用程序,更新了注册表等,还用于卸载clickonce应用程序。

项目结构

  • ClickOnce应用程序 - 部署到服务器http://someserver/app.client.application
  • 控制台应用程序1
    • 这将启动在安装MSI时调用上述URL的进程
    • 当MSI正在卸载时,如果clickonce应用程序正在运行,应用程序将被关闭/终止,则会读取clickonce uninstallstring并启动尝试卸载clickonce应用程序的进程
  • 控制台应用程序2,在安装时创建事件日志源,并在卸载时删除
  • MSI Wrapper - 用于安装和卸载clickonce应用程序。

这有自定义操作集

- Install
    * Primary output from console Application 2
    * Primary output from console Application 1

- Uninstall
    * Primary output from console Application 1
    * Primary output from console Application 2

控制台应用程序1& 2挂钩到安装程序上的BeforeInstall和AfterInstall事件。

安装时一切正常,事件日志源被创建,clickonce应用程序启动并安装。安装部分运行顺利,我没有问题。

但是我在卸载时遇到问题,MSI会自行卸载并调用进程来卸载clickonce,它会抛出提示并删除事件日志源。

以下是错误详情

有一个弹出窗口显示'卸载应用程序没有成功。详细了解更多信息。

单击详细信息按钮可打开错误详细信息文本

PLATFORM VERSION INFO
Windows             : 6.1.7600.0 (Win32NT)
Common Language Runtime     : 4.0.30319.239
System.Deployment.dll       : 4.0.30319.1 (RTMRel.030319-0100)
clr.dll             : 4.0.30319.239 (RTMGDR.030319-2300)
dfdll.dll           : 4.0.30319.1 (RTMRel.030319-0100)
dfshim.dll          : 4.0.31106.0 (Main.031106-0000)

IDENTITIES
Deployment Identity     : XXXXX.Client.application, Culture=neutral, PublicKeyToken=0000000000000000, processorArchitecture=msil

ERROR SUMMARY
Below is a summary of the errors, details of these errors are listed later in the log.
* Error occurred during store lookup, component store may have been corrupted. Following failure messages were detected:
    + Application is not installed.
* Error occurred during uninstall of the application. Following failure messages were detected:
    + Application is not installed.
* Exception occurred during uninstall of application XXXXX.Client.application, Culture=neutral, PublicKeyToken=0000000000000000, processorArchitecture=msil. Following failure messages were detected:
    + Shortcut removal could not be completed. Publisher or product value is not valid. 

COMPONENT STORE TRANSACTION FAILURE SUMMARY
No transaction error was detected.

WARNINGS
There were no warnings during this operation.

OPERATION PROGRESS STATUS
* [4/17/2012 10:52:36 AM] : Looking up information from component store.
* [4/17/2012 10:52:36 AM] : Uninstall of application XXXXX.Client.application, Culture=neutral, PublicKeyToken=0000000000000000, processorArchitecture=msil did not succeed.

ERROR DETAILS
Following errors were detected during this operation.
* [4/17/2012 10:52:36 AM] System.Deployment.Application.DeploymentException (SubscriptionState)
    - Application is not installed.
    - Source: System.Deployment
    - Stack trace:
        at System.Deployment.Application.SubscriptionStore.CheckInstalled(SubscriptionState subState)
        at System.Deployment.Application.SubscriptionStore.CheckInstalledAndShellVisible(SubscriptionState subState)
        at System.Deployment.Application.DeploymentServiceCom.MaintainSubscriptionInternal(String textualSubId)
* [4/17/2012 10:52:36 AM] System.Deployment.Application.DeploymentException (SubscriptionState)
    - Application is not installed.
    - Source: System.Deployment
    - Stack trace:
        at System.Deployment.Application.SubscriptionStore.CheckInstalled(SubscriptionState subState)
        at System.Deployment.Application.SubscriptionStore.UninstallSubscription(SubscriptionState subState)
        at System.Deployment.Application.DeploymentServiceCom.MaintainSubscriptionInternal(String textualSubId)
* [4/17/2012 10:52:36 AM] System.Deployment.Application.DeploymentException (Subscription)
    - Shortcut removal could not be completed. Publisher or product value is not valid. 
    - Source: System.Deployment
    - Stack trace:
        at System.Deployment.Application.ShellExposure.RemoveSubscriptionShellExposure(SubscriptionState subState)
        at System.Deployment.Application.DeploymentServiceCom.MaintainSubscriptionInternal(String textualSubId)

COMPONENT STORE TRANSACTION DETAILS
No transaction information is available.

我尝试了很多方法,似乎没有任何工作

  1. 从注册表中读取uninstallstring并启动进程。
  2. 创建了一个vbsript并将其添加为自定义操作。 (objShell.Run“rundll32.exe dfshim.dll,ShArpMaintain XXXXX.Client.application,Culture = neutral,PublicKeyToken = 0000000000000000,processorArchitecture = msil”)
  3. 创建了一个cmd / bat文件(包含rundll32.exe dfshim.dll,ShArpMaintain XXXXX.Client.application,Culture = neutral,PublicKeyToken = 0000000000000000,processorArchitecture = msil)并在卸载时启动它。
  4. 所有这三种方法都会引发同样的错误。但是,当我单独运行它们时似乎都有效。我花了两天多的时间试着把头发拉出来。

0 个答案:

没有答案