private static void PromoteVersion(ref XElement sourceElement, ref XElement targetElement, VersioningOptions versioningOptions)
        {
            var common = sourceElement.Element(XmlConstants.CommonVersion);
            var major = common.Element(XmlConstants.Major).Value;
            var minor = common.Element(XmlConstants.Minor).Value;
            var patch = common.Element(XmlConstants.Patch).Value;

            common = targetElement.Element(XmlConstants.CommonVersion);
            common.Element(XmlConstants.Major).Value = major;
            common.Element(XmlConstants.Minor).Value = minor;
            common.Element(XmlConstants.Patch).Value = patch;

            var buildValues = targetElement.Elements(XmlConstants.Build)
                .Where(xe => xe.Attribute("name")!=null && xe.Attribute("name").Value.Equals(versioningOptions.Destination.Build, StringComparison.InvariantCultureIgnoreCase))
                .Descendants()
                .Where(xe => xe.Name == XmlConstants.Build || xe.Name == XmlConstants.Revision)
                .ToList();
            buildValues.ForEach(x => x.Value = "0");
            DoPatching(ref targetElement, versioningOptions.Destination.Build);
        }
        private static void SetNewVersion(ref XElement element, VersioningOptions versioningOptions)
        {
            var common = element.Element(XmlConstants.CommonVersion);
            common.Element(XmlConstants.Major).Value = versioningOptions.Numbers.Major;
            common.Element(XmlConstants.Minor).Value = versioningOptions.Numbers.Minor;
            common.Element(XmlConstants.Patch).Value = versioningOptions.Numbers.Patch;

            var toReset = element.Descendants()
                .SelectMany(xe => xe.Descendants())
                .Where(xe => xe.Name == Parameters.Build || xe.Name == Parameters.Revision)
                .ToList();
            toReset.ForEach(x => x.Value = "0");
            DoPatching(ref element, versioningOptions.Target.Build);
        }
        private static void DoVersioning()
        {
            var vOptions = new VersioningOptions(Arguments);

            var xml = XDocument.Load(vOptions.FileName);
            var element = xml.XPathSelectElement($"//Definitions/Definition[@type=\"{vOptions.Target.Name}\"]");

            switch (vOptions.Action)
            {
                case VersioningAction.SetNewVersion:
                    SetNewVersion(ref element, vOptions);
                    break;
                case VersioningAction.Promote:
                    var targetElement = xml.XPathSelectElement($"//Definitions/Definition[@type=\"{vOptions.Destination.Name}\"]");
                    PromoteVersion(ref element, ref targetElement, vOptions);
                    break;
                case VersioningAction.Patch:
                    DoPatching(ref element, vOptions.Target.Build);
                    break;
                case VersioningAction.ReBuild:
                    DoPatching(ref element, vOptions.Target.Build, true);
                    break;
            }

            xml.Save(vOptions.FileName);
        }