簡體   English   中英

無法卸載使用 wix 安裝程序安裝的應用程序

[英]Unable to uninstall the application which is installed using wix installer

我已經使用wix安裝程序為我的c#應用程序創建了一個安裝程序。

安裝進行得很好,但我無法卸載該應用程序。 我看到下面的日志

MSI (s) (78:AC) [15:32:06:199]: Machine policy value 'Debug' is 0
MSI (s) (78:AC) [15:32:06:199]: ******* RunEngine:
       ******* Product: C:\wix\Installer\\bin\Debug\MyService-Debug-x86.msi
       ******* Action: 
       ******* CommandLine: **********
MSI (s) (78:AC) [15:32:06:207]: Machine policy value 'DisableUserInstalls' is 0
MSI (s) (78:AC) [15:32:06:326]: Note: 1: 2203 2: 
C:\Windows\Installer\inprogressinstallinfo.ipi 3: -2147287038 
MSI (s) (78:AC) [15:32:06:327]: Machine policy value 
'LimitSystemRestoreCheckpointing' is 0 
MSI (s) (78:AC) [15:32:06:327]: Note: 1: 1717 2: My Service (32bit) 
MSI (s) (78:AC) [15:32:06:327]: Note: 1: 2205 2:  3: Error 
MSI (s) (78:AC) [15:32:06:327]: Note: 1: 2228 2:  3: Error 4: SELECT 
`Message` FROM `Error` WHERE `Error` = 1717 
MSI (s) (78:AC) [15:32:06:327]: Calling SRSetRestorePoint API. 
dwRestorePtType: 1, dwEventType: 102, llSequenceNumber: 0, szDescription: 
"Removed My Service (32bit)".
MSI (s) (78:AC) [15:32:06:330]: The System Restore service is disabled. 
Returned status: 1058. GetLastError() returned: 1058
MSI (s) (78:AC) [15:32:06:332]: File will have security applied from OpCode.
MSI (s) (78:AC) [15:32:06:362]: SOFTWARE RESTRICTION POLICY: Verifying 
package --> 'C:\wix\Installer\\bin\Debug\MyService-Debug-x86.msi' against 
software restriction policy
MSI (s) (78:AC) [15:32:06:363]: Note: 1: 2262 2: DigitalSignature 3: 
-2147287038 
MSI (s) (78:AC) [15:32:06:363]: SOFTWARE RESTRICTION POLICY: 
C:\wix\Installer\\bin\Debug\MyService-Debug-x86.msi is not digitally signed
MSI (s) (78:AC) [15:32:06:365]: SOFTWARE RESTRICTION POLICY: 
C:\wix\Installer\\bin\Debug\MyService-Debug-x86.msi is permitted to run at 
the 'unrestricted' authorization level.
MSI (s) (78:AC) [15:32:06:366]: MSCOREE not loaded loading copy from 
system32
MSI (s) (78:AC) [15:32:06:374]: End dialog not enabled
MSI (s) (78:AC) [15:32:06:374]: Original package ==> 
C:\wix\Installer\\bin\Debug\MyService-Debug-x86.msi
MSI (s) (78:AC) [15:32:06:374]: Package we're running from ==> 
C:\Windows\Installer\152e2e.msi

在創建安裝程序時,我從未想過數字簽名等等。 跟簽有關系嗎? 完全迷路了,需要幫助

我什至嘗試過使用命令行(管理模式)運行uninstallation但沒有運氣

msiexec.exe /x "C:\wix\Installer\\bin\Debug\MyService-Debug-x86.msi" /L*V "C:\work\wix.log"

它說

已安裝此產品的另一個版本。 此版本的安裝無法繼續。 要配置或刪除此產品的現有版本,請使用控制面板上的添加/刪除程序。

在卸載之前,我可能必須重建安裝程序代碼。 是否有可能與安裝程序相關的某些“guid”發生了變化? 我必須在registry檢查什么?

使用 Wix 代碼更新了問題

添加自定義操作后,問題開始出現。 自定義操作的職責是從安裝程序獲取參數並更新 appsettings.json。 但是這個卸載問題不允許我繼續執行。

  <Property Id="APPLICATIONLOG.PATHFORMAT"  Secure="yes"/>

  <Binary Id="CustomActionDLL" 
          SourceFile="..\..\Installer\CustomActions\bin\$(var.Configuration)\CustomAction.CA.dll" />

  <CustomAction Id="SetPropertyAppLogPathId"
                Property="SetPropertyAppLogPathProperty"
                Value="APPLICATIONLOG.PATHFORMAT=[APPLICATIONLOG.PATHFORMAT]"/>

  <CustomAction Id="SetPropertyAppLogPathProperty"
                BinaryKey="CustomActionDLL"
                DllEntry="UpdateConfigurationsAction"
                Execute="deferred"
                Return="check"
                Impersonate="no" />

  <InstallExecuteSequence>
    <Custom Action="SetPropertyAppLogPathId" Before="SetPropertyAppLogPathProperty"><![CDATA[NOT Installed]]></Custom>
    <Custom Action="SetPropertyAppLogPathProperty" After="InstallFiles"></Custom>
  </InstallExecuteSequence>

我的自定義操作 c# 代碼

public class CustomActions
{
    public static string ApplicationPath { get; private set; }

    [CustomAction]
    public static ActionResult UpdateConfigurationsAction(Session session)
    {
        try
        {
            session.Log("Begin UpdateConfigurationsAction");
            ApplicationPath = session.CustomActionData["APPLICATIONLOG.PATHFORMAT"];
            session.Log("Application Log Path is: " + ApplicationPath);
            return ActionResult.Success;
        }
        catch (Exception e)
        {
            session.Log("Error in UpdateConfigurationsAction  " + e.Message);
            return ActionResult.Failure;
        }

    }
}

問題解決了

問題出在自定義操作上。 制作正確的 InstallExecuteSequence 后,它起作用了!

將在解決方案部分更新

交叉鏈接如何清除損壞的卸載


Microsoft FixIt :在嘗試其他任何事情之前,也許可以嘗試使用Microsoft FixIt 工具,看看您是否可以擺脫任何懸而未決的安裝。 如果不成功,請進一步檢查其他方法。

調試和日志記錄:接下來根據自定義操作調試(我推薦the Advanced Installer MSI CA debugging video ,這是一個快速且不錯的“hello debugger”會話)和收集日志信息來修復包中的自定義操作

對策:最后,可以添加一個屬性來抑制自定義操作的運行,如此處所述"Adding Condition"部分)。

  • 這是我所知道的最簡單的想法,可以抑制在卸載時運行的自定義操作 - 您只需設置所涉及的屬性,以便在自定義操作崩潰時抑制自定義操作。 >
  • 我會將它用於我所有的自定義操作 - 事實上 - 所以我可以將它們全部(或者可能一個一個)抑制 - 特別是對於遇到“catch 22”情況(由於以下原因無法安裝,升級或卸載)的卸載場景自定義操作錯誤)。

懸空安裝:為了檢測所有相關的懸空安裝(如果有),您可以使用以下方法: 無法從 WiX 創建的 MSI 卸載程序(枚舉所有具有相同升級代碼的產品)。


我現在將添加這些鏈接,以防您發現懸空版本:

在嘗試刪除卸載時崩潰的 MSI 時,核心問題是涉及多少台計算機? 如果只是一個,那么破解緩存的MSI數據庫可能是可以接受的,否則您應該創建一個補丁包來修復卸載順序,然后以正常方式觸發卸載。


鏈接

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM