Wix Custom BA正确处理升级

时间:2015-03-02 20:48:52

标签: wix bootstrapper burn wix3.9

我一直在与Wix自定义引导程序作斗争,试图让升级正常运行。 BA升级代码保持不变,而MSI文件具有新的产品代码。我只在ARP中显示BA,而不是MSI。我已经知道它正确地升级了所有的MSI文件,但是当它到达终点并打开旧的bundle来卸载它时,它会打开并执行,但是ARP中的条目仍然是现在我有两个。

以下是完整代码(减去一些GUI特定代码):

public class MainViewModel : ViewModelBase
{
    public MainViewModel(BootstrapperApplication bootstrapper)
    {
        isInstall = true;
        isUpgrade = false;
        isOldBundle = false;
        userHasCancelled = false;
        encounteredError = false;
        ExitEnabled = true;
        installedArchitecture = "";

        this.Bootstrapper = bootstrapper;

        //Add listeners to all the events here

        Command command = bootstrapper.Command;
        if (command.Action == LaunchAction.Uninstall) {
            isInstall = false;
            if (command.Display == Display.Embedded) {
                isOldBundle = true;
            }
        }

        if (!isOldBundle) {
            Messenger.Default.Register<SwitchViewMessage>(this, (switchViewMessage) =>
            {
                SwitchView(switchViewMessage.ViewName);
            });

            SwitchView("Install");
        }
    }

    private bool install64Bit()
    {
        return optionsDataContext.SelectedArchitecture == 0;
    }

    private bool isInstall;
    private bool isUpgrade;
    private bool userHasCancelled;
    private bool encounteredError;

    public BootstrapperApplication Bootstrapper { get; private set; }

    private void OptionsExecute()
    {
        SwitchView("Options");
    }

    private void InstallExecute()
    {
        if (FrameView == optionsView) {
            //Ok pressed in Options View
            optionsDataContext.StoreLastInstallLocation();
            SwitchView("Install");
        } else if (installDataContext.AcceptLicense) {                
            Bootstrapper.Engine.StringVariables["InstallFolder"] = optionsDataContext.InstallLocation;

            Bootstrapper.Engine.Plan(LaunchAction.Install);
            SwitchView("Progress");
        } else {
            TopMostMessageBox.Show("You must accept the License Agreement.", "Error");
        }
    }

    private void UninstallExecute()
    {
        Bootstrapper.Engine.Plan(LaunchAction.Uninstall);
        SwitchView("Progress");
    }

    private void ExitExecute()
    {
        if (FrameView == optionsView) {
            //Cancel pressed in Options View
            optionsDataContext.RestoreLastInstallLocation();
            SwitchView("Install");
        } else if (FrameView == progressView) {
            //Cancel mid installation
            userHasCancelled = true;
            this.ExitEnabled = false;
            SwitchView("Complete");
        } else {
            if (FrameView == completeView) {
                if (!userHasCancelled && !encounteredError && isInstall && completeDataContext.LaunchApplication) {
                    string exePath = optionsDataContext.InstallLocation + "\\program\\flexsim.exe";
                    ProcessStartInfo exeFile = new ProcessStartInfo(exePath);
                    Process.Start(exeFile);
                }
            }
            FlexSimBootstrapper.BootstrapperDispatcher.InvokeShutdown();
        }
    }

    private void OnApplyComplete(object sender, ApplyCompleteEventArgs e)
    {
        OptionsEnabled = false;
        InstallEnabled = false;
        UninstallEnabled = false;
        if (e.Status < 0) {
            userHasCancelled = true;
            SwitchView("Complete");
        }
    }

    private string installedArchitecture;

    private void OnDetectPackageComplete(object sender, DetectPackageCompleteEventArgs e)
    {
        if (isOldBundle) { //Don't do anything with packages, we're just uninstalling the bundle
            return;
        }
        if (e.PackageId.StartsWith("FlexSim")) {
            if (!isInstall) {
                //If we're being upgraded, the packages were already upgraded

            } else {
                if (e.State == PackageState.Absent) {
                    if (installedArchitecture.Length > 0)
                        return;
                    OptionsEnabled = true;
                    isInstall = true;
                    this.InstallEnabled = true; //Update the InstallView
                } else if (e.State == PackageState.Present) {
                    installedArchitecture = e.PackageId.Substring(e.PackageId.Length - 3, 3);
                    isInstall = false;
                    this.InstallEnabled = false; //Update the InstallView
                    UninstallEnabled = true;
                }
            }
        } else {
            string architecture = (install64Bit() ? "x64" : "x86");
            if (installedArchitecture.Length > 0)
                architecture = installedArchitecture;

            if (isInstall) {
                //If this is a bug fix release, check to see which modules are already installed and
                //whether there are modules to be updated
                if (e.PackageId == ("Conveyor_" + architecture)) {
                    if (e.State == PackageState.Present) {
                        installDataContext.ConveyorEnabled = false;
                    } else {
                        installDataContext.InstallConveyor = true;
                    }
                } else if (e.PackageId == ("AGV_" + architecture)) {
                    if (e.State == PackageState.Present) {
                        installDataContext.AGVEnabled = false;
                    } else {
                        installDataContext.InstallAGV = true;
                    }
                } else if (e.PackageId == ("AStar_" + architecture)) {
                    if (e.State == PackageState.Present) {
                        installDataContext.AStarEnabled = false;
                    } else {
                        installDataContext.InstallAStar = true;
                    }
                }
            } else {
                  //Check to see which modules were installed and only show those checkboxes
                if (e.PackageId == ("Conveyor_" + architecture)) {
                    if (e.State == PackageState.Absent) {
                        installDataContext.ConveyorEnabled = false;
                    } else {
                        installDataContext.InstallConveyor = true;
                    }
                } else if (e.PackageId == ("AGV_" + architecture)) {
                    if (e.State == PackageState.Absent) {
                        installDataContext.AGVEnabled = false;
                    } else {
                        installDataContext.InstallAGV = true;
                    }
                } else if (e.PackageId == ("AStar_" + architecture)) {
                    if (e.State == PackageState.Absent) {
                        installDataContext.AStarEnabled = false;
                    } else {
                        installDataContext.InstallAStar = true;
                    }
                }
            }
        }
    }

    private void OnPlanPackageBegin(object sender, PlanPackageBeginEventArgs e)
    {
        if (isOldBundle) { //Don't do anything with packages, we're just uninstalling the bundle
            return;
        }
        string architecture = install64Bit() ? "x64" : "x86";
        if (e.PackageId.StartsWith("Conveyor")) {
            bool installConveyor = installDataContext.InstallConveyor && installDataContext.ConveyorEnabled && e.PackageId.EndsWith(architecture);
            e.State = installConveyor ? (isInstall ? RequestState.Present : RequestState.Absent) : RequestState.None;
        } else if (e.PackageId.StartsWith("AGV")) {
            bool installAGV = installDataContext.InstallAGV && installDataContext.AGVEnabled && e.PackageId.EndsWith(architecture);
            e.State = installAGV ? (isInstall ? RequestState.Present : RequestState.Absent) : RequestState.None;
        } else if (e.PackageId.StartsWith("AStar")) {
            bool installAStar = installDataContext.InstallAStar && installDataContext.AStarEnabled && e.PackageId.EndsWith(architecture);
            e.State = installAStar ? (isInstall ? RequestState.Present : RequestState.Absent) : RequestState.None;
        } else if (e.PackageId.StartsWith("FlexSim")) {
            e.State = e.PackageId.EndsWith(architecture) ? (isInstall ? RequestState.Present : RequestState.Absent) : RequestState.None;
        }
    }

    private void OnPlanComplete(object sender, PlanCompleteEventArgs e)
    {
        if (e.Status >= 0)
            Bootstrapper.Engine.Apply(System.IntPtr.Zero);
    }

    private void OnExecuteMsiMessage(object sender, ExecuteMsiMessageEventArgs e)
    {
        if (e.MessageType == InstallMessage.ActionStart) {
            string text = e.Message.Split(' ')[2];
            text = text.TrimEnd('.');

            //Turn the camel case text into a more readable format
            var r = new Regex(@"
             (?<=[A-Z])(?=[A-Z][a-z]) |
             (?<=[^A-Z])(?=[A-Z]) |
             (?<=[A-Za-z])(?=[^A-Za-z])", RegexOptions.IgnorePatternWhitespace);

            progressDataContext.ProgressText = r.Replace(text, " ");
        }
    }

    private void OnProgress(object sender, ProgressEventArgs e)
    {
        progressDataContext.ProgressPercent = e.OverallPercentage;

        // handle user cancellations here
        if (userHasCancelled)
            e.Result = Result.Cancel;
    }

    private void OnExecuteProgress(object sender, ExecuteProgressEventArgs e)
    {
        progressDataContext.ProgressPercent = e.ProgressPercentage;

        if (userHasCancelled)
            e.Result = Result.Cancel;
    }

    private void OnCacheAcquireProgress(object sender, CacheAcquireProgressEventArgs e)
    {
        progressDataContext.ProgressPercent = e.OverallPercentage;
        string packageName = e.PackageOrContainerId.Substring(0, e.PackageOrContainerId.Length - 4); //Remove architecture
        progressDataContext.ProgressText = "Downloading " + packageName + (packageName == "FlexSim" ? "" : "Module");

        if (userHasCancelled)
            e.Result = Result.Cancel;
    }

    private void OnCacheAcquireBegin(object sender, CacheAcquireBeginEventArgs e)
    {
        progressDataContext.ProgressPercent = 0;
        string packageName = e.PackageOrContainerId.Substring(0, e.PackageOrContainerId.Length - 4); //Remove architecture
        progressDataContext.ProgressText = "Beginning download of " + packageName + (packageName == "FlexSim" ? "" : "Module");
    }

    private void OnCacheAcquireComplete(object sender, CacheAcquireCompleteEventArgs e)
    {
        progressDataContext.ProgressPercent = 100; 
        string packageName = e.PackageOrContainerId.Substring(0, e.PackageOrContainerId.Length - 4); //Remove architecture
        progressDataContext.ProgressText = "Download of " + packageName + (packageName == "FlexSim" ? "" : "Module") + " Complete";
    }

    private void OnCacheComplete(object sender, CacheCompleteEventArgs e)
    {
        progressDataContext.ProgressPercent = 100;
        progressDataContext.PackageName = "Download Complete";
        progressDataContext.ProgressText = "";
    }

    private void OnError(object sender, ErrorEventArgs e)
    {
        string packageName = e.PackageId.Substring(0, e.PackageId.Length - 4); //Remove architecture
        if (e.PackageId == "Netfx4Full")
            packageName = ".NET 4.0";
        TopMostMessageBox.Show(e.ErrorMessage, "Error " + (isUpgrade ? "Upgrading" : (isInstall ? "Installing" : "Uninstalling")) + " " + packageName);
        if (packageName == "FlexSim" || packageName == ".NET 4.0")
            encounteredError = true; //Rollback
    }

    private void OnExecuteFilesInUse(object sender, ExecuteFilesInUseEventArgs e)
    {
        string packageName = e.PackageId.Substring(0, e.PackageId.Length - 4); //Remove architecture
        if (e.PackageId == "Netfx4Full")
            packageName = ".NET 4.0";
        DialogResult result = TopMostMessageBox.Show("Unable to continue installation, files are in use. Please close FlexSim before continuing.", "Error " + (isInstall ? "Installing" : "Uninstalling") + " " + packageName, MessageBoxButtons.RetryCancel);
        if (result == DialogResult.Cancel)
            encounteredError = true; //Rollback
    }

    private void OnExecutePackageBegin(object sender, ExecutePackageBeginEventArgs e)
    {
        progressDataContext.ProgressPercent = 0;
        string packageName = e.PackageId.Substring(0, e.PackageId.Length - 4); //Remove architecture
        Guid relatedBundle;
        if (Guid.TryParse(e.PackageId.Substring(1, e.PackageId.Length - 2), out relatedBundle)) {
            progressDataContext.PackageName = "Cleaning Up...";
            progressDataContext.ProgressText = "";
        } else {
            progressDataContext.PackageName = (isUpgrade ? "Upgrading" : (isInstall ? "Installing" : "Uninstalling")) + " " + packageName + "...";
            progressDataContext.ProgressText = "Opening package";
        }
    }

    private void OnExecutePackageComplete(object sender, ExecutePackageCompleteEventArgs e)
    {
        progressDataContext.ProgressPercent = 100;
    }

   private void OnExecuteComplete(object sender, ExecuteCompleteEventArgs e)
    {
        if (isUpgrade && !isInstall) {
            //Uninstalling the old bootstrapper
            Bootstrapper.Engine.Quit(0);
            Environment.Exit(0);
            return;
        }

        SwitchView("Complete");
    }

   private void OnResolveSource(object sender, ResolveSourceEventArgs e)
   {
       string architecture = install64Bit() ? "x64" : "x86";
       if (!string.IsNullOrEmpty(e.DownloadSource) && e.PackageOrContainerId.EndsWith(architecture))
       {
           e.Result = Result.Download;

           progressDataContext.PackageName = "Please wait, downloading installation files...";
           progressDataContext.ProgressText = "Contacting server";
       }
   }

   private void OnDetectRelatedBundle(object sender, DetectRelatedBundleEventArgs e)
   {
       if (e.Version.ToString() == "7.5.0.0") {
           TopMostMessageBox.Show("Please uninstall FlexSim 7.5.0 before running this installer.", "Error");
           Environment.Exit(0);
       } else {
           isUpgrade = true;
           if (Bootstrapper.Command.Display == Display.Embedded) {
               //This bootstrapper is being run after FlexSim was upgraded in order to remove it from the ARP
               Bootstrapper.Engine.Plan(LaunchAction.Uninstall);
           } else {
               installDataContext.IsUpgrade = true;
               this.AppName = getFullProductName() + " Upgrade";
               this.InstallName = "Upgrade";
           }
       }
   }

这里是升级包的日志:

Burn v3.9.1006.0, Windows v6.2 (Build 9200: Service Pack 0), path: \\hulk\Temp\Matt Long\FlexSim7.5.4\FlexSimInstaller.exe, cmdline: ''
Setting string variable 'WixBundleLog' to value 'C:\Users\DEVELO~1\AppData\Local\Temp\FlexSim_7.5.4_20150303100732.log'
Setting string variable 'WixBundleOriginalSource' to value '\\hulk\Temp\Matt Long\FlexSim7.5.4\FlexSimInstaller.exe'
Setting string variable 'WixBundleOriginalSourceFolder' to value '\\hulk\Temp\Matt Long\FlexSim7.5.4\'
Setting string variable 'WixBundleName' to value 'FlexSim 7.5.4'
Loading managed bootstrapper application.
Creating BA thread to run asynchronously.
Launching FlexSimBootstrapper UX
Detect begin, 9 packages
Setting string variable 'Netfx4x64FullVersion' to value '4.5.50709'
Setting string variable 'Netfx4FullVersion' to value '4.5.50709'
Detected related bundle: {c2bb38d9-e545-4dee-a6e6-2e483f088a7a}, type: Upgrade, scope: PerMachine, version: 7.5.2.0, operation: MajorUpgrade
Condition 'Netfx4FullVersion AND (NOT VersionNT64 OR Netfx4x64FullVersion)' evaluates to true.
Detected related package: {65565599-386F-4A2A-B63E-88A873AE8AB8}, scope: PerMachine, version: 7.5.2.0, language: 0 operation: MajorUpgrade
Detected related package: {65565599-386F-4A2A-B63E-88A873AE8AB8}, scope: PerMachine, version: 7.5.2.0, language: 0 operation: MajorUpgrade
Detected related package: {65565599-386F-4A2A-B63E-88A873AE8AB8}, scope: PerMachine, version: 7.5.2.0, language: 0 operation: MajorUpgrade
Detected related package: {65565599-386F-4A2A-B63E-88A873AE8AB8}, scope: PerMachine, version: 7.5.2.0, language: 0 operation: MajorUpgrade
Detected package: Netfx4Full, state: Present, cached: None
Detected package: FlexSim_x86, state: Absent, cached: None
Detected package: FlexSim_x64, state: Absent, cached: None
Detected package: Conveyor_x86, state: Absent, cached: None
Detected package: AGV_x86, state: Absent, cached: None
Detected package: AStar_x86, state: Absent, cached: None
Detected package: Conveyor_x64, state: Absent, cached: None
Detected package: AGV_x64, state: Absent, cached: None
Detected package: AStar_x64, state: Absent, cached: None
Detect complete, result: 0x0
Setting string variable 'InstallFolder' to value 'C:\Program Files\FlexSim7.5'
Plan begin, 9 packages, action: Install
Condition '(VersionNT < v6.0 OR VersionNT64 < v6.0) AND (NOT (Net4FullVersion OR Net4x64FullVersion))' evaluates to false.
Skipping dependency registration on package with no dependency providers: Netfx4Full
Setting string variable 'WixBundleRollbackLog_FlexSim_x64' to value 'C:\Users\DEVELO~1\AppData\Local\Temp\FlexSim_7.5.4_20150303100732_0_FlexSim_x64_rollback.log'
Setting string variable 'WixBundleLog_FlexSim_x64' to value 'C:\Users\DEVELO~1\AppData\Local\Temp\FlexSim_7.5.4_20150303100732_0_FlexSim_x64.log'
Condition 'NOT Installed' evaluates to true.
Condition 'NOT Installed' evaluates to true.
Condition 'NOT Installed' evaluates to true.
Condition 'NOT Installed' evaluates to true.
Condition 'NOT Installed' evaluates to true.
Condition 'NOT Installed' evaluates to true.
Planned package: Netfx4Full, state: Present, default requested: Absent, ba requested: Absent, execute: None, rollback: None, cache: No, uncache: No, dependency: None
Planned package: FlexSim_x86, state: Absent, default requested: Present, ba requested: None, execute: None, rollback: None, cache: No, uncache: No, dependency: None
Planned package: FlexSim_x64, state: Absent, default requested: Present, ba requested: Present, execute: Install, rollback: Uninstall, cache: Yes, uncache: No, dependency: Register
Planned package: Conveyor_x86, state: Absent, default requested: Present, ba requested: None, execute: None, rollback: None, cache: No, uncache: No, dependency: None
Planned package: AGV_x86, state: Absent, default requested: Present, ba requested: None, execute: None, rollback: None, cache: No, uncache: No, dependency: None
Planned package: AStar_x86, state: Absent, default requested: Present, ba requested: None, execute: None, rollback: None, cache: No, uncache: No, dependency: None
Planned package: Conveyor_x64, state: Absent, default requested: Present, ba requested: None, execute: None, rollback: None, cache: No, uncache: No, dependency: None
Planned package: AGV_x64, state: Absent, default requested: Present, ba requested: None, execute: None, rollback: None, cache: No, uncache: No, dependency: None
Planned package: AStar_x64, state: Absent, default requested: Present, ba requested: None, execute: None, rollback: None, cache: No, uncache: No, dependency: None
Planned related bundle: {c2bb38d9-e545-4dee-a6e6-2e483f088a7a}, type: Upgrade, default requested: Absent, ba requested: Absent, execute: Uninstall, rollback: Install, dependency: None
Plan complete, result: 0x0
Apply begin
Creating a system restore point.
Created a system restore point.
Caching bundle from: 'C:\Users\DEVELO~1\AppData\Local\Temp\{67225db2-d963-4067-ba1b-f42a8f1f6dcb}\.be\FlexSimInstaller.exe' to: 'C:\ProgramData\Package Cache\{67225db2-d963-4067-ba1b-f42a8f1f6dcb}\FlexSimInstaller.exe'
Registering bundle dependency provider: {67225db2-d963-4067-ba1b-f42a8f1f6dcb}, version: 7.5.4.0
Acquiring package: FlexSim_x64, payload: FlexSim_x64, copy from: \\hulk\Temp\Matt Long\FlexSim7.5.4\flexsim__7.5.4._x64
Setting string variable 'WixBundleLastUsedSource' to value '\\hulk\Temp\Matt Long\FlexSim7.5.4\'
Verified acquired payload: FlexSim_x64 at path: C:\ProgramData\Package Cache\.unverified\FlexSim_x64, moving to: C:\ProgramData\Package Cache\{DE2D8A1C-DD4A-411C-A23B-A9C0943AFC84}v7.5.4\flexsim__7.5.4._x64.
Registering package dependency provider: {DE2D8A1C-DD4A-411C-A23B-A9C0943AFC84}, version: 7.5.4, package: FlexSim_x64
Applying execute package: FlexSim_x64, action: Install, path: C:\ProgramData\Package Cache\{DE2D8A1C-DD4A-411C-A23B-A9C0943AFC84}v7.5.4\flexsim__7.5.4._x64, arguments: ' ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7" INSTALLDIR="C:\Program Files\FlexSim7.5"'
Applied execute package: FlexSim_x64, result: 0x0, restart: None
Registering dependency: {67225db2-d963-4067-ba1b-f42a8f1f6dcb} on package provider: {DE2D8A1C-DD4A-411C-A23B-A9C0943AFC84}, package: FlexSim_x64
Applying execute package: {c2bb38d9-e545-4dee-a6e6-2e483f088a7a}, action: Uninstall, path: C:\ProgramData\Package Cache\{c2bb38d9-e545-4dee-a6e6-2e483f088a7a}\FlexSimInstaller.exe, arguments: '"C:\ProgramData\Package Cache\{c2bb38d9-e545-4dee-a6e6-2e483f088a7a}\FlexSimInstaller.exe" -uninstall -quiet -burn.related.upgrade -burn.ancestors={67225db2-d963-4067-ba1b-f42a8f1f6dcb}'
Applied execute package: {c2bb38d9-e545-4dee-a6e6-2e483f088a7a}, result: 0x0, restart: None
Apply complete, result: 0x0, restart: None, ba requested restart:  No
Shutting down, exit code: 0x0
Variable: InstallFolder = C:\Program Files\FlexSim7.5
Netfx4FullVersion = 4.5.50709
Netfx4x64FullVersion = 4.5.50709
VersionNT = 6.2.0.0
VersionNT64 = 6.2.0.0
Variable:WixBundleAction = 4
Variable: WixBundleElevated = 1
Variable: WixBundleLastUsedSource = \\hulk\Temp\Matt Long\FlexSim7.5.4\
Variable: WixBundleLog = C:\Users\DEVELO~1\AppData\Local\Temp\FlexSim_7.5.4_20150303100732.log
Variable: WixBundleLog_FlexSim_x64 = C:\Users\DEVELO~1\AppData\Local\Temp\FlexSim_7.5.4_20150303100732_0_FlexSim_x64.log
Variable: WixBundleManufacturer = FlexSim Software Products, Inc.
Variable: WixBundleName = FlexSim 7.5.4
Variable: WixBundleOriginalSource = \\hulk\Temp\Matt Long\FlexSim7.5.4\FlexSimInstaller.exe
Variable: WixBundleOriginalSourceFolder = \\hulk\Temp\Matt Long\FlexSim7.5.4\
Variable: WixBundleProviderKey = {67225db2-d963-4067-ba1b-f42a8f1f6dcb}
Variable: WixBundleRollbackLog_FlexSim_x64 = C:\Users\DEVELO~1\AppData\Local\Temp\FlexSim_7.5.4_20150303100732_0_FlexSim_x64_rollback.log
Variable: WixBundleTag = FlexSim
Variable: WixBundleVersion = 7.5.4.0
Exit code: 0x0, restarting: No

卸载旧捆绑包:

Burn v3.9.1006.0, Windows v6.2 (Build 9200: Service Pack 0), path: C:\ProgramData\Package Cache\{c2bb38d9-e545-4dee-a6e6-2e483f088a7a}\FlexSimInstaller.exe, cmdline: '-burn.unelevated BurnPipe.{75719B82-36F8-4EEC-9627-95F9C80EFD3D} {C5DDF0F8-2C71-4784-918C-123444FEB511} 3048 -uninstall -quiet -burn.related.upgrade -burn.ancestors={67225db2-d963-4067-ba1b-f42a8f1f6dcb} -burn.embedded BurnPipe.{FD72859F-485B-49ED-955A-3BE174642F7C} {7C01F82A-C3C3-42F9-AF31-0E9995FB9E61} 4480'
This bundle is being run by a related bundle as type 'Upgrade'.
Setting string variable 'WixBundleLog' to value 'C:\Users\DEVELO~1\AppData\Local\Temp\FlexSim_7.5.2_20150303100853.log'
Loading managed bootstrapper application.
Creating BA thread to run asynchronously.
Launching FlexSimBootstrapper UX
Detect begin, 9 packages
Setting string variable 'Netfx4x64FullVersion' to value '4.5.50709'
Setting string variable 'Netfx4FullVersion' to value '4.5.50709'
Detected related bundle: {67225db2-d963-4067-ba1b-f42a8f1f6dcb}, type: Upgrade, scope: PerMachine, version: 7.5.4.0, operation: None
Condition 'Netfx4FullVersion AND (NOT VersionNT64 OR Netfx4x64FullVersion)' evaluates to true.
Detected partially cached package: FlexSim_x86, invalid payload: FlexSim_x86, reason: 0x80070002
Detected related package: {DE2D8A1C-DD4A-411C-A23B-A9C0943AFC84}, scope: PerMachine, version: 7.5.4.0, language: 0 operation: Downgrade
Detected related package: {DE2D8A1C-DD4A-411C-A23B-A9C0943AFC84}, scope: PerMachine, version: 7.5.4.0, language: 0 operation: Downgrade
Detected package: Netfx4Full, state: Present, cached: None
Detected package: FlexSim_x86, state: Obsolete, cached: Partial
Detected package: FlexSim_x64, state: Obsolete, cached: Complete
Detected package: Conveyor_x86, state: Absent, cached: None
Detected package: AGV_x86, state: Absent, cached: None
Detected package: AStar_x86, state: Absent, cached: None
Detected package: Conveyor_x64, state: Absent, cached: None
Detected package: AGV_x64, state: Absent, cached: None
Detected package: AStar_x64, state: Absent, cached: None
Detect complete, result: 0x0
Plan begin, 9 packages, action: Uninstall
Plan skipped related bundle: {67225db2-d963-4067-ba1b-f42a8f1f6dcb}, type: Upgrade, because it was previously scheduled.
Skipping dependency registration on package with no dependency providers: Netfx4Full
Planned related bundle: {67225db2-d963-4067-ba1b-f42a8f1f6dcb}, type: Upgrade, default requested: None, ba requested: None, execute: None, rollback: None, dependency: None
Planned package: AStar_x64, state: Absent, default requested: Absent, ba requested: None, execute: None, rollback: None, cache: No, uncache: No, dependency: Unregister
Planned package: AGV_x64, state: Absent, default requested: Absent, ba requested: None, execute: None, rollback: None, cache: No, uncache: No, dependency: Unregister
Planned package: Conveyor_x64, state: Absent, default requested: Absent, ba requested: None, execute: None, rollback: None, cache: No, uncache: No, dependency: Unregister
Planned package: AStar_x86, state: Absent, default requested: Absent, ba requested: None, execute: None, rollback: None, cache: No, uncache: No, dependency: Unregister
Planned package: AGV_x86, state: Absent, default requested: Absent, ba requested: None, execute: None, rollback: None, cache: No, uncache: No, dependency: Unregister
Planned package: Conveyor_x86, state: Absent, default requested: Absent, ba requested: None, execute: None, rollback: None, cache: No, uncache: No, dependency: Unregister
Planned package: FlexSim_x64, state: Obsolete, default requested: None, ba requested: Absent, execute: None, rollback: None, cache: No, uncache: Yes, dependency: Unregister
Planned package: FlexSim_x86, state: Obsolete, default requested: None, ba requested: None, execute: None, rollback: None, cache: No, uncache: Yes, dependency: Unregister
Planned package: Netfx4Full, state: Present, default requested: None, ba requested: None, execute: None, rollback: None, cache: No, uncache: No, dependency: None
Plan complete, result: 0x0
Apply begin
Removed package dependency provider: {124DDD12-0BD0-464E-B753-4BC53D27770A}, package: AStar_x64
Removed package dependency provider: {E48B3FBD-001F-4D1F-876B-B041044B6B87}, package: AGV_x64
Removed package dependency provider: {65E44AB7-FBC5-480A-92B5-519CF57F6CDD}, package: Conveyor_x64
Removed package dependency provider: {124DDD12-0BD0-464E-B753-4BC53D27770A}, package: AStar_x86
Removed package dependency provider: {E48B3FBD-001F-4D1F-876B-B041044B6B87}, package: AGV_x86
Removed package dependency provider: {65E44AB7-FBC5-480A-92B5-519CF57F6CDD}, package: Conveyor_x86
Removed dependency: {c2bb38d9-e545-4dee-a6e6-2e483f088a7a} on package provider: {65565599-386F-4A2A-B63E-88A873AE8AB8}, package FlexSim_x64

3 个答案:

答案 0 :(得分:2)

我终于明白了!怀疑它有点小。这完全取决于时机。

第一个问题是我需要在DetectComplete操作中执行计划卸载:

   private void OnDetectComplete(object sender, DetectCompleteEventArgs e)
   {
       if (Bootstrapper.Command.Action == LaunchAction.Uninstall && Bootstrapper.Command.Display == Display.Embedded)
       {
           Bootstrapper.Engine.Plan(LaunchAction.Uninstall);
       }
   }

然后,卸载旧捆绑包的日志被缩短的原因是由于我提前退出了应用程序。我将其移至ApplyComplete操作:

    private void OnApplyComplete(object sender, ApplyCompleteEventArgs e)
    {
        if (Bootstrapper.Command.Action == LaunchAction.Uninstall && Bootstrapper.Command.Display == Display.Embedded) {
            //Uninstalling the old bootstrapper
            Bootstrapper.Engine.Quit(0);
            Environment.Exit(0);
        }
    }

答案 1 :(得分:1)

Burn太复杂了,无法诊断出只有被剥离的代码。我们需要来自正在卸载的旧捆绑包和正在安装的新捆绑包中的真实代码和/或刻录日志。

您通常应使用LaunchAction属性中的Command.Action来决定要采取的操作。如果你这样做,增加你的包的版本,并删除你的On * RelatedBundle方法,它应该工作。您的OnPlanPackageBegin方法也应该被删除,Burn将在安装操作期间安装软件包,并在默认情况下在卸载操作期间删除软件包。另外,不要将e.Result设置为Result.Error,它不会做任何事情。

答案 2 :(得分:0)

我有一个类似的问题,我们以前的产品安装程序是Msi,现在我们有一个托管引导程序应用程序的第一个版本,其中捆绑了几个先决条件和MSI。我们不得不升级当前安装的产品。我所做的就是为Bundle.wxs链中的相关Msi包设置MsiProperty UPGRADE = 1。

Upgrade older msi from Wix custom BA Bundle

查看我的回答