TaskResult UpdateProjectFileReferences(TaskResult result)
        {
            try
            {
                // Change
                //<EmbeddedResource Include="16.4\16.4.100\NotifyEventTypes.16.4.100.sql" />
                // To
                //<EmbeddedResource Include="16.4\16.4.6\NotifyEventTypes.16.4.6.sql" />

                var fileContent       = File.ReadAllText(UpgradeProjectVbProjectFile);
                var tempUpdateVersion = String.Format("{0}.{1}.{2}", PendingDbVersion.Major, PendingDbVersion.Minor, "100");
                if (fileContent.Contains(tempUpdateVersion))
                {
                    var newVersion         = String.Format("{0}.{1}.{2}", NewDbVersion.Major, NewDbVersion.Minor, NewDbVersion.Revision);
                    var updatedFileContent = fileContent.Replace(tempUpdateVersion, newVersion);
                    File.WriteAllText(UpgradeProjectVbProjectFile, updatedFileContent);
                }
            }
            catch (Exception ex)
            {
                result.AddException(ex);
            }
            return(result);
        }
        TaskResult BackupFiles(TaskResult result)
        {
            try
            {
                var backupDir = @"c:\Backups\DbVersionHelper\";

                if (!Directory.Exists(backupDir))
                {
                    Directory.CreateDirectory(backupDir);
                }

                var backupVersionDir = Path.Combine(backupDir, DateTime.Now.ToString("mmDDyyyy") + "-" + NewDbVersion.ToString());
                if (_isDebug)
                {
                    Console.WriteLine("Backing up directory {0}\r\n--------------- to ---------------\r\n{1}", PendingVersionBuildFolder, backupVersionDir);
                }
                DirectoryCopy(PendingVersionBuildFolder, backupVersionDir, true);
            }
            catch (Exception ex)
            {
                result.AddException(ex);
            }
            return(result);
        }
 /// <summary>
 /// Updates the Minor version vb file.
 /// </summary>
 /// <param name="result"></param>
 /// <returns></returns>
 TaskResult UpdateMinorVersionFile(TaskResult result)
 {
     try
     {
         var fileContent = File.ReadAllText(MinorVersionVbFile);
         // update the class name.
         //Public Class Upgrade16_4_100
         if (fileContent.Contains(PendingUpgradeClassName))
         {
             fileContent = fileContent.Replace(PendingUpgradeClassName, NewUpgradeClassName);
         }
         else
         {
             // need to add the new class to the end of the list.
             fileContent = BuildMinorVersionVbFile();
         }
         File.WriteAllText(MinorVersionVbFile, fileContent);
     }
     catch (Exception ex)
     {
         result.AddException(ex);
     }
     return(result);
 }