无法从另一个托管引导程序应用程序卸载WiX Managed Bootstrapper应用程序

时间:2017-05-19 12:51:11

标签: c# mvvm wix bootstrapper wix3.10

我有自己的Managed Bootstrapper应用程序,使用WiX Toolset开发,使用MVVM模式用c#编写。由于这是一个Managed Bootstrapper应用程序,我也有一个自定义UI。我的Bundle.wxs代码如下

<Bundle Name="NestleMESSetup"
          Version="!(bind.packageVersion.NestleCustomLayerSetupPackage)"
          Manufacturer="CT Infotech"
              UpgradeCode="CCBB8D5B-8171-47FB-AD53-25C6E866C34E"
              Copyright="Copyright© 2017 CT Infotech ALL RIGHTS RESERVED"
              SplashScreenSourceFile="Resources\Splash.bmp"
              IconSourceFile="Resources\menu.ico">

        <Variable Name="KambanVersion" Type="version" Value="!(bind.packageVersion.KambanFASSetup)"/>

        <BootstrapperApplicationRef Id="ManagedBootstrapperApplicationHost">
          <PayloadGroupRef Id="InstallerPayload"/>
        </BootstrapperApplicationRef>

        <util:RegistrySearchRef Id='SearchForKamban' />

        <Chain>
          <PackageGroupRef Id="InstallerPackages"/>
        </Chain>

        <Variable Name="DbName" bal:Overridable="yes" />
        <Variable Name="SqlInstance" bal:Overridable="yes" />
        <Variable Name="InstallPath" bal:Overridable="yes" />
        <Variable Name="Roles" bal:Overridable="yes" />
        <Variable Name="Modules" bal:Overridable="yes" />
        <Variable Name="CustomInstall" bal:Overridable="yes"/>

        <WixVariable Id="WixMbaPrereqPackageId" Value="Netfx4Full" />
        <WixVariable Id="WixMbaPrereqLicenseUrl" Value="NetfxLicense.rtf" />

      </Bundle>

      <Fragment>
        <PayloadGroup Id="InstallerPayload">
          <Payload SourceFile="..\Nestle.MES.Bootstrapper.UI\BootstrapperCore.config"/>
          <Payload SourceFile="..\Nestle.MES.Bootstrapper.UI\bin\$(var.Configuration)\Nestle.MES.Bootstrapper.UI.dll"/>
          <Payload SourceFile="C:\Program Files (x86)\WiX Toolset v3.10\SDK\Microsoft.Deployment.WindowsInstaller.dll"/>
        </PayloadGroup>
      </Fragment>

      <Fragment>
        <PackageGroup Id="InstallerPackages">
          <RollbackBoundary Id="StartingPoint" Vital="yes" />
          <ExePackage Id="KambanFASSetup" Cache="no" Compressed="yes" Vital="yes" Permanent="no" Name="KambanCoreSetup"
                      SourceFile="..\..\Kamban.FAS.Setup_Source\$(var.Configuration)\KambanFASSetup.exe" >
            <CommandLine InstallArgument="[SqlInstance]" Condition="1" />
            <CommandLine InstallArgument="[DbName]" Condition="1"/>
            <CommandLine InstallArgument="[InstallPath]" Condition="1"/>
            <CommandLine InstallArgument="[Roles]" Condition="1"/>
            <CommandLine InstallArgument="[Modules]" Condition="1" />
            <CommandLine InstallArgument="[CustomInstall]" Condition="1"/>
          </ExePackage>

          <MsiPackage SourceFile="..\..\build_folder\$(var.Configuration)\Nestle.MES.CustomLayer\Nestle.MES.CustomLayerSetup.msi"
                      Id="NestleCustomLayerSetupPackage" Cache="yes" Visible="no" Compressed="yes" EnableFeatureSelection="yes" Vital="yes">
            <MsiProperty Name="INSTALLFOLDER" Value="[INSTALLFOLDER]"  />
            <MsiProperty Name="VERSION" Value="[VERSION]"/>
            <MsiProperty Name="ADDLOCAL" Value="[NestleFeatures]" />
          </MsiPackage>
        </PackageGroup>
      </Fragment>

      <Fragment>
        <util:RegistrySearch
          Id='SearchForKamban'
          Variable="KambanInstalled"
          Result="exists"
          Root="HKLM"
          Key="SOFTWARE\Wow6432Node\KambanFAS" />
        <bal:Condition Message="Product already Exists">
          KambanInstalled
        </bal:Condition>
      </Fragment>

在上面的代码中,您可以看到我的Bundle链中有一个MsiPackage和一个ExePackage。带有 Id =“KambanFASSetup”的ExePackage也是一个Managed Bootstrapper应用程序,它有自己的自定义UI。一旦我安装了这个父包exe,我在我的程序和功能中得到两个条目。我相信这是因为我有两个托管的bootstrapper exe。所以现在卸载 NestleMESSetup 时,只有我的MsiPackage被卸载而我的ExePackage没有。但我的要求如下

  • 如果我卸载Parent Exe,也应该卸载ExePackage。
  • 卸载Child ExePackage必须以静默方式进行。即 它的UI应显示 NOT ,提示用户单击卸载 再次按钮。

如果需要更多信息,请告诉我。非常感谢您的帮助。

EDIT1: 以下是%temp%文件夹中的卸载日志

[2658:3330][2017-05-19T19:27:11]i001: Burn v3.10.2.2516, Windows v6.1 (Build 7601: Service Pack 1), path: C:\ProgramData\Package Cache\{a21ebf3e-08b2-4b64-b5bf-38dccfea21a2}\Nestle.MES.Setup.exe
[2658:3330][2017-05-19T19:27:11]i000: Initializing version variable 'KambanVersion' to value '1.0.647.0'
[2658:3330][2017-05-19T19:27:11]i009: Command Line: '/uninstall'
[2658:3330][2017-05-19T19:27:11]i000: Setting string variable 'WixBundleLog' to value 'C:\Users\RAJASA~1.000\AppData\Local\Temp\NestleMESSetup_20170519192711.log'
[2658:3330][2017-05-19T19:27:11]i000: Setting string variable 'WixBundleManufacturer' to value 'CT Infotech'
[2658:3330][2017-05-19T19:27:11]i000: Loading managed bootstrapper application.
[2658:3330][2017-05-19T19:27:11]i000: Creating BA thread to run asynchronously.
[2658:3330][2017-05-19T19:27:11]i100: Detect begin, 2 packages
[2658:3330][2017-05-19T19:27:11]i000: Setting numeric variable 'KambanInstalled' to value 1
[2658:3330][2017-05-19T19:27:11]i101: Detected package: KambanFASSetup, state: Absent, cached: None
[2658:3330][2017-05-19T19:27:11]i101: Detected package: NestleCustomLayerSetupPackage, state: Present, cached: Complete
[2658:3330][2017-05-19T19:27:11]i104: Detected package: NestleCustomLayerSetupPackage, feature: AppFeatures, state: Local
[2658:3330][2017-05-19T19:27:11]i104: Detected package: NestleCustomLayerSetupPackage, feature: WebFeatures, state: Local
[2658:3330][2017-05-19T19:27:11]i104: Detected package: NestleCustomLayerSetupPackage, feature: DbFeatures, state: Local

EDIT2: 将Detect Condition添加到我的Bundle chain Exe包中后,我也无法卸载Parent exe。 WiX日志如下

[1450:1BBC][2017-05-20T07:33:59]i371: Updating session, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{c8fb8ef8-905f-4bd9-8675-91f62d83e5c8}, resume: Active, restart initiated: No, disable resume: No
[1644:0F04][2017-05-20T07:33:59]w341: Prompt for source of container: WixAttachedContainer, path: E:\TFS_Nestle\Nestle\build_folder\Debug\Nestle.MES.Setup\Nestle.MES.Setup.exe
[1644:0F04][2017-05-20T07:33:59]e054: Failed to resolve source for file: E:\TFS_Nestle\Nestle\build_folder\Debug\Nestle.MES.Setup\Nestle.MES.Setup.exe, error: 0x80070002.
[1644:0F04][2017-05-20T07:33:59]e000: Error 0x80070002: Failed while prompting for source (original path 'E:\TFS_Nestle\Nestle\build_folder\Debug\Nestle.MES.Setup\Nestle.MES.Setup.exe').    [1644:0F04][2017-05-20T07:33:59]e311: Failed to acquire container: WixAttachedContainer to working path: C:\Users\RAJASA~1.000\AppData\Local\Temp\{B5BE6652-F453-40B5-A2BF-6313B191EA7F}\9FD1B9E707102B3EB2E75EA87962C5C839E9588A, error: 0x80070002.
[1644:1B24][2017-05-20T07:33:59]e000: Error 0x80070002: Failed while caching, aborting execution.
[1450:1BBC][2017-05-20T07:33:59]i372: Session end, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{c8fb8ef8-905f-4bd9-8675-91f62d83e5c8}, resume: ARP, restart: None, disable resume: No
[1450:1BBC][2017-05-20T07:33:59]i371: Updating session, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{c8fb8ef8-905f-4bd9-8675-91f62d83e5c8}, resume: ARP, restart initiated: No, disable resume: No
[1644:1B24][2017-05-20T07:33:59]i399: Apply complete, result: 0x80070002, restart: None, ba requested restart:  No
[1644:1B24][2017-05-20T07:33:59]i500: Shutting down, exit code: 0x0

1 个答案:

答案 0 :(得分:3)

您的ExePackage缺少UninstallCommand属性,因此刻录不知道如何正确卸载它。它应该像

UninstallCommand="/uninstall /quiet"

如果需要可能会有一些补充。

为了能够检测到ExePackage,它应该定义属性DetectCondition。像

这样的东西
DetectCondition="KambanInstalled"