簡體   English   中英

Wix Custom BA正確處理升級

[英]Wix Custom BA properly handle upgrade

我一直在與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

我終於想通了! 懷疑它有點小。 這完全取決於時機。

第一個問題是我需要在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);
        }
    }

刻錄太復雜,無法診斷出僅剝離的代碼。 我們需要來自正在卸載的舊捆綁包和正在安裝的新捆綁包的真實代碼和/或刻錄日志。

您通常應該使用Command.Action屬性中的LaunchAction來決定要采取的操作。 如果你這樣做,增加你的包的版本,並刪除你的On * RelatedBundle方法,它應該工作。 您的OnPlanPackageBegin方法也應該被刪除,Burn將在安裝操作期間安裝軟件包,並在默認情況下在卸載操作期間刪除軟件包。 另外,不要將e.Result設置為Result.Error ,它不會做任何事情。

我有一個類似的問題,我們以前的產品安裝程序是一個Msi,現在我們有一個托管引導程序應用程序的第一個版本,其中捆綁了幾個先決條件和MSI。 我們不得不升級當前安裝的產品。 我所做的就是為Bundle.wxs鏈中的相關Msi包設置MsiProperty UPGRADE = 1。

從Wix自定義BA Bundle升級舊版msi,看看我的答案

暫無
暫無

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

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