0

When we install a package and there is an existing item, we see this message:

enter image description here

I would like to

  1. Keep the Merge > Append selected as default.
  2. Change the existing description text for each option.

I see this URL in the browser console - /sitecore/shell/Applications/Tools/Installer*/InstallationWizard

But could not find the Installer folder in my local instance.
Is this possible. How to go about it.

2
  • 2
    You do know that in every package you can set the defaults? You can even select different defaults per section in your package. If the defaults are set, you won't even get this popup so the installation can go faster.
    – Gatogordo
    Dec 14, 2022 at 8:21
  • @Gatogordo Not while creating the package. I want the default in the system. So, that even if at package level it is not set, the default will be displayed.
    – sukesh
    Dec 14, 2022 at 9:39

2 Answers 2

4

Sitecore has provided these options in the Sitecore.Client DLL. When I extracted it I found the code under the class Sitecore.Shell.Applications.Install.Controls.BehaviourOptionEditor where it is setting the default values like this.

protected virtual void SetValue(BehaviourOptions value)
{
    InstallMode itemMode = value.ItemMode;
    this.OverwriteItems.Checked = false;
    this.OverwriteItems.Checked = itemMode == InstallMode.Overwrite;
    this.MergeItems.Checked = false;
    this.MergeItems.Checked = itemMode == InstallMode.Merge;
    this.SideBySideItems.Checked = false;
    this.SideBySideItems.Checked = itemMode == InstallMode.SideBySide;
    this.SkipItems.Checked = false;
    this.SkipItems.Checked = itemMode == InstallMode.Skip;
    this.AskUser.Checked = false;
    this.AskUser.Checked = itemMode == InstallMode.Undefined;
    if (!this.MergeOption)
    return;
    this.SelectListItem(((int) value.ItemMergeMode).ToString(), this.MergeOptions);
    this.MergeOptions.Disabled = !this.MergeItems.Checked;
}

And here you can find the default descriptions.

private void ShowHint(BehaviourOptions value)
{
  switch (value.ItemMode)
  {
    case InstallMode.Undefined:
      this.messageText = this.User != PackageUser.Developer ? Translate.Text("Choose any option to view option description.") : Translate.Text("If files with the same ID or Path are found, you will be asked to resolve the conflict.");
      break;
    case InstallMode.Overwrite:
      this.messageText = Translate.Text("Replace the entire subtree with the subtree in the package.");
      break;
    case InstallMode.Merge:
      StringBuilder stringBuilder = new StringBuilder();
      switch (value.ItemMergeMode)
      {
        case MergeMode.Undefined:
          stringBuilder.Append(Translate.Text("Undefined."));
          break;
        case MergeMode.Clear:
          stringBuilder.Append(Translate.Text("Leave the subtree and replace any matching items and versions with those from the package but do not replace any subitems."));
          break;
        case MergeMode.Append:
          stringBuilder.Append(Translate.Text("Leave the subtree. Overwrite nothing. Append any matching item versions to the existing subtree by giving them incremental numbers."));
          break;
        case MergeMode.Merge:
          stringBuilder.Append(Translate.Text("Leave the subtree and replace any matching items and versions with those from the package."));
          break;
      }
      this.messageText = stringBuilder.ToString();
      break;
    case InstallMode.Skip:
      this.messageText = Translate.Text("Take no action and move on to the next item.");
      break;
    case InstallMode.SideBySide:
      this.messageText = Translate.Text("Install second item from the package without touching any existing items.");
      break;
  }
  this.BehaviorOptionText.Text = this.messageText.ToString();
}

You will find the XML in this location.

wwwroot\<your-site-root>\sitecore\shell\Applications\Install\Dialogs\Install package

And the reference of this class can be found in this XML.

wwwroot\<your-site-root>\sitecore\shell\Applications\Install\Controls\BehaviourOptionEditor.xml

You can update and replace the XML with your own class here.

I hope this is enough information to get started.

Thanks.

2
  • Thank you. This is what I was looking for. If I don't want to replace the xml, is it possible to do it with a patch config that refers to my custom class?
    – sukesh
    Dec 15, 2022 at 3:37
  • 1
    No I think you need to replace the XML by providing the reference of your class. Dec 15, 2022 at 4:02
6

While creating the packages you can set these options so whenever you will install the packages it will not ask you for the options and it will perform the options which you have selected while generating the packages.

When you create any package in the left panel you will have a package name under the Sources:

enter image description here

Now select the Name of the packages and click on the Installation Options tab:

enter image description here

Select the installer to behave and create your packages. It will not ask you the options while installing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.