Ejemplo n.º 1
0
        public override bool Execute()
        {
            var productVersion = VersionUtil.GetProductVersion(_buildVersion);

            // The System.Version class conveniently parses and compares version numbers in just the format we need.

            var currentVersion = new Version(productVersion);

            if (currentVersion.Build <= 0 && currentVersion.Revision <= 0)
            {
                // The current release is a major release, so the baseline is the LAST major release and we need to run
                // all the hotfixes for the last release before the scripts for this one. Eg. if the current release is
                // 3.2 then we need to restore the 3.1 baseline, then run scripts for 3.1.1, 3.1.2, etc. and finally 3.2.

                _baselineVersion = GetLastMajorVersion(currentVersion).ToString(2);
            }
            else
            {
                // The current release is a minor release, so the baseline is the CURRENT major release and we need to run
                // only the hotfixes for this release up to, and including, the current release. Eg. if the current release is
                // 3.1.3 then we need to restore the 3.1 baseline, then run scripts for 3.1.1, 3.1.2 and 3.1.3, but not for
                // 3.1.4 (which might also exist).

                _baselineVersion = currentVersion.ToString(2);
            }

            return(true);
        }
Ejemplo n.º 2
0
 public override bool Execute()
 {
     try
     {
         _productVersion = VersionUtil.GetProductVersion(_buildVersion);
         return(true);
     }
     catch (Exception e)
     {
         Log.LogErrorFromException(e);
         return(false);
     }
 }