コード例 #1
0
        private void SetNewSolutionVersion(IExecutionContainer container, string setversion, Entity cdSolution, Version currentversion)
        {
            Version newversion;

            if (setversion.Equals("IncrementAll", StringComparison.OrdinalIgnoreCase))
            {
                newversion = new Version("1.0.0.0");
                foreach (var existingversion in ExistingSolutionVersions.Values)
                {
                    if (existingversion > newversion)
                    {
                        newversion = existingversion;
                    }
                }
                newversion = IncrementVersion(newversion);
            }
            else if (setversion.Equals("Increment", StringComparison.OrdinalIgnoreCase))
            {
                newversion = IncrementVersion(currentversion);
            }
            else if (setversion.Equals("Current", StringComparison.OrdinalIgnoreCase))
            {
                newversion = currentversion;
            }
            else
            {
                newversion = new Version(setversion);
            }
            if (!currentversion.Equals(newversion))
            {
                SendLine(container, $"Setting version: {newversion}");
                var cdSolUpd = cdSolution.CloneId();
                cdSolUpd.SetAttribute("version", newversion.ToString());
                container.Save(cdSolUpd);
            }
        }