Quantcast
Channel: wixsharp Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1354

New Post: Wix# CustomAction bug if Sequence is NotInSequence

$
0
0
Я всего лишь хотел сказать, что я нашел багу в создании WIX файла:
если выставить
    project.ControlPanelInfo.InstallLocation = "[INSTALLDIR]";
    project.ControlPanelInfo.NoModify = true;
то создаются 2 Action, и 2 записи в <InstallExecuteSequence><Custom Action="Set_ARPINSTALLLOCATION" after="InstallInitialize">
если в добавок к этому создать свой Action
    new ManagedAction("ValidateLicenceKey") { Id = "ValidateLicenceKey", Sequence = Sequence.NotInSequence },
то оно испортит первую запись <InstallExecuteSequence><Custom Action="Set_ARPINSTALLLOCATION" after="ValidateLicenceKey">
Но по логике ValidateLicenceKey нигде не должен упоминать в InstallExecuteSequence.
Чтобы исправить данный баг я предлагаю заменить 1 строчку в Compiler.cs:2353 ProcessCustomActions
               string step = wAction.Step.ToString();

                if (wAction.When == When.After && wAction.Step == Step.PreviousAction)
                {
                    if (lastActionName == null)
                        throw new Exception("Step.PreviousAction is specified for the very first 'Custom Action'.\nThere cannot be any previous action as it is the very first one in the sequence.");
                    step = lastActionName;
                }
                else if (wAction.When == When.After && wAction.Step == Step.PreviousActionOrInstallFinalize)
                    step = lastActionName ?? Step.InstallFinalize.ToString();
                else if (wAction.When == When.After && wAction.Step == Step.PreviousActionOrInstallInitialize)
                    step = lastActionName ?? Step.InstallInitialize.ToString();

                lastActionName = wAction.Id;

                List<XElement> sequences = new List<XElement>();

                if (wAction.Sequence != Sequence.NotInSequence)
                {
                    foreach (var item in wAction.Sequence.GetValues())
                        sequences.Add(product.SelectOrCreate(item));
                }
на
               string step = wAction.Step.ToString();

                if (wAction.When == When.After && wAction.Step == Step.PreviousAction)
                {
                    if (lastActionName == null)
                        throw new Exception("Step.PreviousAction is specified for the very first 'Custom Action'.\nThere cannot be any previous action as it is the very first one in the sequence.");
                    step = lastActionName;
                }
                else if (wAction.When == When.After && wAction.Step == Step.PreviousActionOrInstallFinalize)
                    step = lastActionName ?? Step.InstallFinalize.ToString();
                else if (wAction.When == When.After && wAction.Step == Step.PreviousActionOrInstallInitialize)
                    step = lastActionName ?? Step.InstallInitialize.ToString();

                if(wAction.Sequence != Sequence.NotInSequence)
                    lastActionName = wAction.Id;

                List<XElement> sequences = new List<XElement>();

                if (wAction.Sequence != Sequence.NotInSequence)
                {
                    foreach (var item in wAction.Sequence.GetValues())
                        sequences.Add(product.SelectOrCreate(item));
                }

Viewing all articles
Browse latest Browse all 1354

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>